jellies-draw 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
}
|
|
47
47
|
}, 200)
|
|
48
48
|
},
|
|
49
|
-
generate({ x, y, radiusX, radiusY, scaleX, scaleY, fill, stroke, strokeWidth }) {
|
|
49
|
+
generate({ x, y, radiusX, radiusY, scaleX, scaleY, skewX, rotation, fill, stroke, strokeWidth }) {
|
|
50
50
|
const newEllipse = new Konva.Ellipse({
|
|
51
51
|
x,
|
|
52
52
|
y,
|
|
@@ -54,6 +54,8 @@ export default {
|
|
|
54
54
|
radiusY,
|
|
55
55
|
scaleX,
|
|
56
56
|
scaleY,
|
|
57
|
+
skewX,
|
|
58
|
+
rotation,
|
|
57
59
|
fill,
|
|
58
60
|
stroke,
|
|
59
61
|
strokeWidth,
|
|
@@ -34,12 +34,14 @@ export default {
|
|
|
34
34
|
finish() {
|
|
35
35
|
this.temporalShape = null
|
|
36
36
|
},
|
|
37
|
-
generate({ x, y, scaleX, scaleY, points, stroke, strokeWidth }) {
|
|
37
|
+
generate({ x, y, scaleX, scaleY, skewX, rotation, points, stroke, strokeWidth }) {
|
|
38
38
|
const newLine = new Konva.Line({
|
|
39
39
|
x,
|
|
40
40
|
y,
|
|
41
41
|
scaleX,
|
|
42
42
|
scaleY,
|
|
43
|
+
skewX,
|
|
44
|
+
rotation,
|
|
43
45
|
points,
|
|
44
46
|
stroke,
|
|
45
47
|
strokeWidth,
|
|
@@ -44,7 +44,7 @@ export default {
|
|
|
44
44
|
}
|
|
45
45
|
}, 200)
|
|
46
46
|
},
|
|
47
|
-
generate({ x, y, scaleX, scaleY, width, height, fill, stroke, strokeWidth }) {
|
|
47
|
+
generate({ x, y, scaleX, scaleY, width, height, skewX, rotation, fill, stroke, strokeWidth }) {
|
|
48
48
|
const newRectangle = new Konva.Rect({
|
|
49
49
|
x,
|
|
50
50
|
y,
|
|
@@ -52,6 +52,8 @@ export default {
|
|
|
52
52
|
scaleY,
|
|
53
53
|
width,
|
|
54
54
|
height,
|
|
55
|
+
skewX,
|
|
56
|
+
rotation,
|
|
55
57
|
fill,
|
|
56
58
|
stroke,
|
|
57
59
|
strokeWidth,
|
|
@@ -10,7 +10,14 @@ export default {
|
|
|
10
10
|
disableTextareaHandler: null,
|
|
11
11
|
handleTextareaTimer: null,
|
|
12
12
|
show({ offsetX, offsetY }) {
|
|
13
|
-
if (
|
|
13
|
+
if (Canvas.isEditingText) {
|
|
14
|
+
return
|
|
15
|
+
}
|
|
16
|
+
clearTimeout(this.handleTextareaTimer)
|
|
17
|
+
this.handleTextareaTimer = setTimeout(() => {
|
|
18
|
+
if (Canvas.isEditingText) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
14
21
|
const newText = this.generate({
|
|
15
22
|
text: '',
|
|
16
23
|
x: offsetX,
|
|
@@ -19,13 +26,10 @@ export default {
|
|
|
19
26
|
width: 200,
|
|
20
27
|
fill: Properties.strokeColor
|
|
21
28
|
})
|
|
22
|
-
this.temporalText = newText
|
|
23
|
-
Canvas.layer.add(this.temporalText)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this._handleEnableTextarea(newText)
|
|
27
|
-
}, 200)
|
|
28
|
-
}
|
|
29
|
+
this.temporalText = newText;
|
|
30
|
+
Canvas.layer.add(this.temporalText);
|
|
31
|
+
this._handleEnableTextarea(newText)
|
|
32
|
+
}, 200)
|
|
29
33
|
},
|
|
30
34
|
bindEvents(newText) {
|
|
31
35
|
newText.off('dblclick dbltap')
|
|
@@ -123,11 +127,16 @@ export default {
|
|
|
123
127
|
},
|
|
124
128
|
_handleDisableTextarea(event) {
|
|
125
129
|
if (event.target !== this.textarea) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
if (this.textarea.value) {
|
|
131
|
+
this.temporalText.text(this.textarea.value)
|
|
132
|
+
this.temporalText.show()
|
|
133
|
+
this.textarea.remove()
|
|
134
|
+
} else {
|
|
135
|
+
this.textarea.remove()
|
|
136
|
+
this.temporalText.remove()
|
|
137
|
+
}
|
|
130
138
|
Properties.tool = 'selector'
|
|
139
|
+
window.removeEventListener('mousedown', this.disableTextareaHandler)
|
|
131
140
|
}
|
|
132
141
|
},
|
|
133
142
|
_handleTextareaEditing() {
|
|
@@ -157,7 +166,7 @@ export default {
|
|
|
157
166
|
}
|
|
158
167
|
this.textarea.style.width = `${ newWidth }px`;
|
|
159
168
|
},
|
|
160
|
-
generate({ text, x, y, fill, fontSize, width, height, scaleX, scaleY }) {
|
|
169
|
+
generate({ text, x, y, fill, fontSize, width, height, scaleX, scaleY, skewX, rotation }) {
|
|
161
170
|
const newText = new Konva.Text({
|
|
162
171
|
text,
|
|
163
172
|
x,
|
|
@@ -168,6 +177,8 @@ export default {
|
|
|
168
177
|
height,
|
|
169
178
|
scaleX,
|
|
170
179
|
scaleY,
|
|
180
|
+
skewX,
|
|
181
|
+
rotation,
|
|
171
182
|
name: 'node',
|
|
172
183
|
nodeType: 'text',
|
|
173
184
|
strokeEnabled: false
|