Skip to content

Commit 6524d99

Browse files
authored
updated animation - wip (#1)
1 parent 96afb5e commit 6524d99

File tree

6 files changed

+38
-51
lines changed

6 files changed

+38
-51
lines changed

src/components/DiagramLink.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ export default {
9393
linkClass() {
9494
if (this.link.animated) {
9595
if (this.link.inverted_flow){
96-
return "diagram-editor-rl__animated";
96+
return "diagram-editor__animated1";
9797
}
98-
return "diagram-editor-lr__animated";
98+
return "diagram-editor__animated0";
9999
}
100100
return "";
101101
},

src/components/DiagramNode.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export default {
197197
return this.node.size.width - 4;
198198
},
199199
slotHeight() {
200+
// отступ - заготовок - отступ
200201
return this.node.size.height - 22;
201202
},
202203
nodeDeletable() {
@@ -286,7 +287,7 @@ export default {
286287
if (hex.length !== 6) {
287288
throw new Error("Invalid HEX color.");
288289
}
289-
var r = parseInt(hex.slice(0, 2), 16),
290+
let r = parseInt(hex.slice(0, 2), 16),
290291
g = parseInt(hex.slice(2, 4), 16),
291292
b = parseInt(hex.slice(4, 6), 16);
292293
if (bw) {
@@ -295,7 +296,7 @@ export default {
295296
r = (255 - r).toString(16);
296297
g = (255 - g).toString(16);
297298
b = (255 - b).toString(16);
298-
return "#" + padZero(r) + padZero(g) + padZero(b);
299+
return "#" + r + g + b;
299300
},
300301
},
301302
};

src/components/DiagramNodeTitle.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@
3333
class="diagram-editor__delete"
3434
@click="$emit('delete')"
3535
>
36-
<rect x="0" y="0" width="12" height="12" rx="2" ry="2" />
37-
<!-- <circle cx="2" cy="2" r="12" /> -->
38-
<line :x1="2" :y1="2" :x2="10" :y2="10" />
39-
<line :x1="10" :y1="2" :x2="2" :y2="10" />
36+
<rect x="0" y="0" width="12" height="12" rx="2" ry="2"/>
37+
<line :x1="2" :y1="2" :x2="10" :y2="10"/>
38+
<line :x1="10" :y1="2" :x2="2" :y2="10"/>
4039
</svg>
4140
</svg>
4241
</template>

src/helpers.js

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,14 @@
11
export const getAbsoluteXY = element => {
2-
var viewportElement = document.documentElement;
3-
var box = element.getBoundingClientRect();
4-
var scrollLeft = viewportElement.scrollLeft;
5-
var scrollTop = viewportElement.scrollTop;
6-
return {
7-
x: box.left + scrollLeft,
8-
y: box.top + scrollTop
9-
};
2+
const viewportElement = document.documentElement;
3+
const box = element.getBoundingClientRect();
4+
const scrollLeft = viewportElement.scrollLeft;
5+
const scrollTop = viewportElement.scrollTop;
6+
return {
7+
x: box.left + scrollLeft,
8+
y: box.top + scrollTop
9+
};
1010
};
1111

1212
export const snapToGrip = (val, gridSize) => {
13-
return gridSize * Math.round(val / gridSize);
14-
};
15-
16-
export const invertColor = (hex, bw) => {
17-
if (hex.indexOf('#') === 0) {
18-
hex = hex.slice(1);
19-
}
20-
if (hex.length === 3) {
21-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
22-
}
23-
if (hex.length !== 6) {
24-
throw new Error('Invalid HEX color.');
25-
}
26-
var r = parseInt(hex.slice(0, 2), 16),
27-
g = parseInt(hex.slice(2, 4), 16),
28-
b = parseInt(hex.slice(4, 6), 16);
29-
if (bw) {
30-
return (r * 0.299 + g * 0.587 + b * 0.114) > 186
31-
? '#000000'
32-
: '#FFFFFF';
33-
}
34-
r = (255 - r).toString(16);
35-
g = (255 - g).toString(16);
36-
b = (255 - b).toString(16);
37-
return "#" + padZero(r) + padZero(g) + padZero(b);
13+
return gridSize * Math.round(val / gridSize);
3814
};

src/mixins/DiagramEditorMixin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ export default () => ({
136136
this.selectedLink = null;
137137
}
138138
this.$emit("clear-selection", data);
139-
140139
},
141140

142141
toggleMoveEventListener(enable) {

src/style.scss

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
margin: 1px;
1717

1818
rect {
19-
fill: rgba($color: #be3232);
20-
fill-opacity: 0.7;
19+
fill: rgba($color: #fff, $alpha: 0.3);
20+
fill-opacity: 0.25;
2121
}
2222

2323
line {
24-
stroke: #fff;
24+
stroke: rgb(0, 0, 0);
2525
stroke-width: 2;
2626
}
2727
}
@@ -47,26 +47,38 @@
4747
}
4848
}
4949

50-
.diagram-editor-lr__animated {
50+
.diagram-editor__animated {
5151
stroke-dasharray: 10;
5252
stroke-dashoffset: 1000;
53-
animation: diagram-editor--link-pulse-LR 50s linear infinite;
53+
animation: diagram-editor--link-pulse 50s linear infinite;
5454
}
5555

56-
.diagram-editor-rl__animated {
56+
@keyframes diagram-editor--link-pulse {
57+
to {
58+
stroke-dashoffset: 0;
59+
}
60+
}
61+
62+
.diagram-editor__animated0 {
63+
stroke-dasharray: 10;
64+
stroke-dashoffset: 1000;
65+
animation: diagram-editor-lr--link-pulse 50s linear infinite;
66+
}
67+
68+
.diagram-editor__animated1 {
5769
stroke-dasharray: 10;
5870
stroke-dashoffset: 1000;
59-
animation: diagram-editor--link-pulse-RL 50s linear infinite;
71+
animation: diagram-editor-rl--link-pulse 50s linear infinite;
6072
}
6173

6274

63-
@keyframes diagram-editor--link-pulse-LR {
75+
@keyframes diagram-editor-lr--link-pulse {
6476
to {
6577
stroke-dashoffset: 0;
6678
}
6779
}
6880

69-
@keyframes diagram-editor--link-pulse-RL {
81+
@keyframes diagram-editor-rl--link-pulse {
7082
from {
7183
stroke-dashoffset: 0;
7284
}

0 commit comments

Comments
 (0)