resize - Javascript elements only snapping to grid from right side -


i trying resize elements snap grid , far working if resize right side , bottom reason doesn't work left side. sure it's math here code:

var dimension = win.getdimension(); var neww = math.round(dimension[0] / 10) * 10; var newh = math.round(dimension[1] / 10) * 10; win.setdimension(neww, newh); 

any ideas?

so ended doing having event called onbeforeresizestart saved current x position window , in onresizefinish event checked see if new x position matched saved x position. if did not updated x position , did same snap calculation.

onbeforeresizestart:

var position = getcoords(win); window.currentx = position.left; 

onresizefinish

var position = getcoords(win); if(position.left != window.currentx) {     var newx = math.round(position.left / 10) * 10;     win.setposition(newx, position.top); }  var dimension = win.getdimension(); var neww = math.round(dimension[0] / 10) * 10; var newh = math.round(dimension[1] / 10) * 10;  win.setdimension(neww, newh); 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -