@@ -432,6 +432,7 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
432
432
return ;
433
433
}
434
434
const { rect } = this . manager . stateApi . getBbox ( ) ;
435
+ const gridSize = this . manager . stateApi . getGridSize ( ) ;
435
436
const width = this . konva . proxyRect . width ( ) ;
436
437
const height = this . konva . proxyRect . height ( ) ;
437
438
const scaleX = rect . width / width ;
@@ -445,8 +446,8 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
445
446
const offsetY = ( rect . height - height * scale ) / 2 ;
446
447
447
448
this . konva . proxyRect . setAttrs ( {
448
- x : clamp ( Math . round ( rect . x + offsetX ) , rect . x , rect . x + rect . width ) ,
449
- y : clamp ( Math . round ( rect . y + offsetY ) , rect . y , rect . y + rect . height ) ,
449
+ x : clamp ( roundToMultiple ( rect . x + offsetX , gridSize ) , rect . x , rect . x + rect . width ) ,
450
+ y : clamp ( roundToMultiple ( rect . y + offsetY , gridSize ) , rect . y , rect . y + rect . height ) ,
450
451
scaleX : scale ,
451
452
scaleY : scale ,
452
453
rotation : 0 ,
@@ -463,6 +464,7 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
463
464
return ;
464
465
}
465
466
const { rect } = this . manager . stateApi . getBbox ( ) ;
467
+ const gridSize = this . manager . stateApi . getGridSize ( ) ;
466
468
const width = this . konva . proxyRect . width ( ) ;
467
469
const height = this . konva . proxyRect . height ( ) ;
468
470
const scaleX = rect . width / width ;
@@ -476,8 +478,8 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
476
478
const offsetY = ( rect . height - height * scale ) / 2 ;
477
479
478
480
this . konva . proxyRect . setAttrs ( {
479
- x : Math . round ( rect . x + offsetX ) ,
480
- y : Math . round ( rect . y + offsetY ) ,
481
+ x : roundToMultiple ( rect . x + offsetX , gridSize ) ,
482
+ y : roundToMultiple ( rect . y + offsetY , gridSize ) ,
481
483
scaleX : scale ,
482
484
scaleY : scale ,
483
485
rotation : 0 ,
0 commit comments