Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gr1m1um committed Sep 24, 2021
1 parent f83037b commit eabe2a2
Show file tree
Hide file tree
Showing 16 changed files with 298 additions and 144 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Connects nodes using svg lines
></edge>
```

Edges require node references `{ from: id|Object, to: String|Object }`, if nodes are refered by `id(String)` an array `nodes` must be passed:
Edges require node references `{ from: id|Object, to: String|Object }`, if nodes are refered by `id(String)` an array `nodes` must be passed:

```html
<edge
Expand Down Expand Up @@ -141,11 +141,11 @@ Surrounds a group of nodes with a rectangle, allows dragging multiple nodes.

### Port

Placed inside a node, automatically offsets edges to a determined position inside the nodes html (see Ports demo).
Placed inside a node, automatically offsets edges to a their position inside the nodes html [Ports demo].

### Label

Create a label positioned relative to an edge
Create a label node that is positioned along an edge

```html
<v-label :edge="graph.edges[0]" :perc="50" :offset="{x: 0, y: -50}">
Expand All @@ -156,7 +156,7 @@ Create a label positioned relative to an edge
### graph.js

Can be used to store edges and nodes.
Contains utility methods to build graphs, position nodes, remove and create nodes, edges and so on.
Contains utility methods to build graphs, layouts, remove and create nodes, edges and so on.

## Styling

Expand Down
3 changes: 2 additions & 1 deletion lib/svg-pan-zoom/svg-pan-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,9 @@ SvgPanZoom.prototype.getPublicInstance = function() {
// Create cache
if (!this.publicInstance) {
this.publicInstance = this.pi = {
options: this.options,
// Pan
enablePan: function() {that.options.panEnabled = true; return that.pi}
enablePan: function() {that.options.panEnabled = true; return that.pi}
, disablePan: function() {that.options.panEnabled = false; return that.pi}
, isPanEnabled: function() {return !!that.options.panEnabled}
, pan: function(point) {that.pan(point); return that.pi}
Expand Down
124 changes: 100 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/components/Edge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ export default {
util.lineLine(x1, y1, x2, y2, box[2], box[1], box[2], box[3]), // right
util.lineLine(x1, y1, x2, y2, box[0], box[3], box[2], box[3]) // bottom
].filter(i => i)
const start = new Victor(x1, y1)
return intersections
.map(i => Object.assign(i, { distance: start.distance(new Victor(i.x, i.y)) }))
Expand Down
11 changes: 5 additions & 6 deletions src/components/Group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
:y="minY - padding.top - margin"
:width="width + (padding.left + padding.right) + margin * 2"
:height="height + (padding.top + padding.bottom) + margin * 2"
@mousedown="onMousedown"
>
<div class="content" ref="content" :style="contentMargin">
<slot>
</slot>
</div>
@mousedown="onMousedown">
<div class="content" ref="content" :style="contentMargin">
<slot>
</slot>
</div>
</foreignObject>
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/components/Label.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
props: {
edge: {
type: Object,
required: true // { id, pathd } required
required: true // { id, pathd }
},
perc: {
type: Number,
Expand Down
24 changes: 12 additions & 12 deletions src/components/Markers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
<g>
<g v-for="marker in all" :key="marker.id">
<marker v-if="marker.type === 'arrow-start'"
:id="marker.id" orient="auto"
:markerWidth="13 * marker.scale"
:markerHeight="13 * marker.scale"
:refX="1 * marker.scale"
:refY="5 * marker.scale">
<path d="M0,5 L10,10 L10,0 L0,5" :style="`${marker.style};transform: scale(${marker.scale})`"/>
:id="marker.id" orient="auto"
:markerWidth="13 * marker.scale"
:markerHeight="13 * marker.scale"
:refX="1 * marker.scale"
:refY="5 * marker.scale">
<path d="M0,5 L10,10 L10,0 L0,5" :style="`${marker.style};transform: scale(${marker.scale})`"/>
</marker>
<marker v-if="marker.type === 'arrow-end'"
:id="marker.id" orient="auto"
:markerWidth="13 * marker.scale"
:markerHeight="13 * marker.scale"
:refX="9 * marker.scale"
:refY="5 * marker.scale">
<path d="M0,0 L0,10 L10,5 L0,0" :style="`${marker.style};transform: scale(${marker.scale})`"/>
:id="marker.id" orient="auto"
:markerWidth="13 * marker.scale"
:markerHeight="13 * marker.scale"
:refX="9 * marker.scale"
:refY="5 * marker.scale">
<path d="M0,0 L0,10 L10,5 L0,0" :style="`${marker.style};transform: scale(${marker.scale})`"/>
</marker>
</g>
</g>
Expand Down
Loading

0 comments on commit eabe2a2

Please sign in to comment.