mirror of
https://github.com/viliusle/miniPaint.git
synced 2026-02-06 11:21:47 +00:00
fixed issue, where opening big image + json would end with wrong preview in main canvas
This commit is contained in:
parent
076ceae74e
commit
e32e7d6a6e
@ -658,7 +658,8 @@ class Base_layers_class {
|
||||
}
|
||||
|
||||
/**
|
||||
* returns global position, for example if canvas is zoomed, it will convert relative mouse position to absolute at 100% zoom.
|
||||
* returns global position, for example if canvas is zoomed, it will convert relative mouse position to absolute
|
||||
* at 100% zoom.
|
||||
*
|
||||
* @param {int} x
|
||||
* @param {int} y
|
||||
|
||||
@ -16,7 +16,7 @@ var template = `
|
||||
<div class="canvas_preview_details">
|
||||
<div class="details">
|
||||
<button title="Zoom out" class="layer_add trn" id="zoom_less"">-</button>
|
||||
<button title="Reset zoom level" class="layer_add trn" id="zoom_100"">100%</button>
|
||||
<button title="Reset zoom level" class="layer_add trn" id="zoom_100">100%</button>
|
||||
<button title="Zoom in" class="layer_add trn" id="zoom_more"">+</button>
|
||||
<button class="layer_add trn" id="zoom_fit">Fit</button>
|
||||
</div>
|
||||
@ -209,7 +209,7 @@ class GUI_preview_class {
|
||||
this.canvas_preview.stroke();
|
||||
}
|
||||
|
||||
zoom(recalc) {
|
||||
async zoom(recalc) {
|
||||
if (recalc != undefined) {
|
||||
//zoom-in or zoom-out
|
||||
if (recalc == 1 || recalc == -1) {
|
||||
@ -275,6 +275,10 @@ class GUI_preview_class {
|
||||
|
||||
config.need_render = true;
|
||||
this.GUI.prepare_canvas();
|
||||
|
||||
//sleep after last image import, it maybe not be finished yet
|
||||
await new Promise(r => setTimeout(r, 10));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -428,7 +428,7 @@ class File_open_class {
|
||||
}
|
||||
|
||||
/**
|
||||
* includes provided resource (iamge or json)
|
||||
* includes provided resource (image or json)
|
||||
*
|
||||
* @param string resource_url
|
||||
*/
|
||||
@ -591,6 +591,9 @@ class File_open_class {
|
||||
|
||||
const actions = [];
|
||||
|
||||
//reset zoom
|
||||
await this.Base_gui.GUI_preview.zoom(100); //reset zoom
|
||||
|
||||
//set attributes
|
||||
actions.push(
|
||||
new app.Actions.Refresh_action_attributes_action('undo'),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user