Skip to content

Commit e07bce0

Browse files
committed
fix for multiple shows one after another
1 parent 7534d2c commit e07bce0

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

build/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@
5151
hoverControl: '#6F6762',
5252
hoverControlContent: '#fff',
5353
},
54-
// defaultTool : 'brush',
55-
/* hiddenTools: [
54+
//defaultTool : 'brush',
55+
//how_to_paste_actions: ['extend_right'],
56+
/*hiddenTools: [
5657
'select',
5758
'crop',
5859
'pixelize',
@@ -75,8 +76,9 @@
7576
'bucket',
7677
'clear',
7778
'settings',
78-
], */
79-
saveHandler: this._onPainterroSave,
79+
],
80+
*/
81+
saveHandler: this._onPainterroSave,
8082
});
8183
window.p.show()
8284
const ctx = window.p.ctx;

js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ class PainterroProc {
855855
}
856856

857857
handleToolEvent(eventHandler, event) {
858-
if (this.select.imagePlaced) {
858+
if (this.select.imagePlaced || this.select.area.activated) {
859859
return this.select[eventHandler](event);
860860
}
861861
if (this.activeTool && this.activeTool.eventListner) {

js/selecter.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ ${Math.round(pxData[i][j][3] / s)})`;
163163
}
164164

165165
placeAt(l, t, r, b, img) {
166+
167+
if (this.imagePlaced) {
168+
// for case when user inserts multiple images one after another without finishing placing them
169+
this.finishPlacing();
170+
}
171+
166172
this.main.closeActiveTool(true);
167173
this.main.setActiveTool(this.main.defaultTool);
168174
const scale = this.getScale();
@@ -202,6 +208,7 @@ ${Math.round(pxData[i][j][3] / s)})`;
202208
this.area.topl[1],
203209
this.area.bottoml[0] - this.area.topl[0],
204210
this.area.bottoml[1] - this.area.topl[1]);
211+
this.area.activated = false;
205212
}
206213

207214
cancelPlacing() {
@@ -212,9 +219,12 @@ ${Math.round(pxData[i][j][3] / s)})`;
212219
}
213220

214221
handleKeyDown(evt) {
222+
console.log(1)
215223
if (this.main.inserter.handleKeyDown(evt)) {
216224
return true;
217225
}
226+
console.log(2)
227+
218228
if (this.shown && this.imagePlaced) {
219229
if (evt.keyCode === KEYS.enter) {
220230
this.finishPlacing();

0 commit comments

Comments
 (0)