editor: fix resizing when pixel scaling != 1
This commit is contained in:
parent
4f69a73d0f
commit
5fbc6fe029
2 changed files with 5 additions and 6 deletions
|
|
@ -107,10 +107,9 @@ var callbacks = module.exports = {
|
|||
var style = document.createElement('style');
|
||||
style.innerHTML = data.join('');
|
||||
document.body.appendChild(style);
|
||||
if (data.indexOf('--pixel-scale')!=-1) {
|
||||
PXSCALE = data.match(/--pixel-scale\s*:\s*([^;]*)/)[1]
|
||||
INITIALZOOM = PXSCALE
|
||||
}
|
||||
GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width")
|
||||
PXSCALE = getComputedStyle(document.documentElement).getPropertyValue("--pixel-scale")
|
||||
INITIALZOOM = PXSCALE
|
||||
},
|
||||
|
||||
reloadCss: function(){
|
||||
|
|
|
|||
|
|
@ -217,8 +217,8 @@ var editObject = function(container, data, refresh){
|
|||
ui.size.width = Math.round(ui.size.width / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH * PXSCALE
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.round((Math.max(ui.size.height,30)/PXSCALE) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.round((Math.max(ui.size.width,30)/PXSCALE) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.round((Math.max(ui.size.height,30)) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.round((Math.max(ui.size.width,30)) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
updateDom(container,data)
|
||||
},
|
||||
grid: [GRIDWIDTH * PXSCALE, GRIDWIDTH * PXSCALE]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue