Skip to content

Commit

Permalink
fix for multiple shows one after another
Browse files Browse the repository at this point in the history
  • Loading branch information
ivictbor committed May 6, 2022
1 parent 7534d2c commit e07bce0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 6 additions & 4 deletions build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
hoverControl: '#6F6762',
hoverControlContent: '#fff',
},
// defaultTool : 'brush',
/* hiddenTools: [
//defaultTool : 'brush',
//how_to_paste_actions: ['extend_right'],
/*hiddenTools: [
'select',
'crop',
'pixelize',
Expand All @@ -75,8 +76,9 @@
'bucket',
'clear',
'settings',
], */
saveHandler: this._onPainterroSave,
],
*/
saveHandler: this._onPainterroSave,
});
window.p.show()
const ctx = window.p.ctx;
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ class PainterroProc {
}

handleToolEvent(eventHandler, event) {
if (this.select.imagePlaced) {
if (this.select.imagePlaced || this.select.area.activated) {
return this.select[eventHandler](event);
}
if (this.activeTool && this.activeTool.eventListner) {
Expand Down
10 changes: 10 additions & 0 deletions js/selecter.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ ${Math.round(pxData[i][j][3] / s)})`;
}

placeAt(l, t, r, b, img) {

if (this.imagePlaced) {
// for case when user inserts multiple images one after another without finishing placing them
this.finishPlacing();
}

this.main.closeActiveTool(true);
this.main.setActiveTool(this.main.defaultTool);
const scale = this.getScale();
Expand Down Expand Up @@ -202,6 +208,7 @@ ${Math.round(pxData[i][j][3] / s)})`;
this.area.topl[1],
this.area.bottoml[0] - this.area.topl[0],
this.area.bottoml[1] - this.area.topl[1]);
this.area.activated = false;
}

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

handleKeyDown(evt) {
console.log(1)
if (this.main.inserter.handleKeyDown(evt)) {
return true;
}
console.log(2)

if (this.shown && this.imagePlaced) {
if (evt.keyCode === KEYS.enter) {
this.finishPlacing();
Expand Down

0 comments on commit e07bce0

Please sign in to comment.