jellies-draw 0.1.6 → 0.1.8
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
|
@@ -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() {
|