center canvas if it is much smaller than screen.

This commit is contained in:
viliusle 2020-10-13 23:53:39 +03:00
parent 6057c8a437
commit 2019fca31d
2 changed files with 6 additions and 2 deletions

View File

@ -531,6 +531,9 @@ body .sp-preview{
-ms-grid-column: 2;
grid-area: main;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.canvas_wrapper{
position:relative;

View File

@ -165,10 +165,9 @@ class Base_gui_class {
window.addEventListener('resize', function (event) {
//resize
_this.prepare_canvas();
_this.check_canvas_offset();
config.need_render = true;
}, false);
_this.check_canvas_offset();
this.check_canvas_offset();
}
check_canvas_offset() {
@ -206,6 +205,8 @@ class Base_gui_class {
//change wrapper dimensions
document.getElementById('canvas_wrapper').style.width = w + 'px';
document.getElementById('canvas_wrapper').style.height = h + 'px';
this.check_canvas_offset();
}
load_saved_changes() {