@@ -4,6 +4,7 @@ import Utils from '../utils';
44import throttle from 'lodash.throttle' ;
55import { MIN_SIZE } from '../tools/Base' ;
66import { FF_DEV_3666 , FF_DEV_3793 , isFF } from '../utils/feature-flags' ;
7+ import { RELATIVE_STAGE_HEIGHT , RELATIVE_STAGE_WIDTH } from '../components/ImageView/Image' ;
78
89const DrawingTool = types
910 . model ( 'DrawingTool' , {
@@ -56,8 +57,8 @@ const DrawingTool = types
5657 get MIN_SIZE ( ) {
5758 if ( isFF ( FF_DEV_3793 ) ) {
5859 return {
59- X : MIN_SIZE . X / self . obj . stageScale / self . obj . stageWidth * 100 ,
60- Y : MIN_SIZE . Y / self . obj . stageScale / self . obj . stageHeight * 100 ,
60+ X : MIN_SIZE . X / self . obj . stageScale / self . obj . stageWidth * RELATIVE_STAGE_WIDTH ,
61+ Y : MIN_SIZE . Y / self . obj . stageScale / self . obj . stageHeight * RELATIVE_STAGE_HEIGHT ,
6162 } ;
6263 }
6364
@@ -231,8 +232,8 @@ const TwoPointsDrawingTool = DrawingTool.named('TwoPointsDrawingTool')
231232
232233 if ( ! shape ) return ;
233234 const isEllipse = shape . type . includes ( 'ellipse' ) ;
234- const maxStageWidth = isFF ( FF_DEV_3793 ) ? 100 : self . obj . stageWidth ;
235- const maxStageHeight = isFF ( FF_DEV_3793 ) ? 100 : self . obj . stageHeight ;
235+ const maxStageWidth = isFF ( FF_DEV_3793 ) ? RELATIVE_STAGE_WIDTH : self . obj . stageWidth ;
236+ const maxStageHeight = isFF ( FF_DEV_3793 ) ? RELATIVE_STAGE_HEIGHT : self . obj . stageHeight ;
236237
237238 let { x1, y1, x2, y2 } = isEllipse ? {
238239 x1 : shape . startX ,
@@ -499,16 +500,17 @@ const ThreePointsDrawingTool = DrawingTool.named('ThreePointsDrawingTool')
499500 const shape = self . getCurrentArea ( ) ;
500501
501502 if ( ! shape ) return ;
502- const { stageWidth, stageHeight } = self . obj ;
503+ const maxStageWidth = isFF ( FF_DEV_3793 ) ? RELATIVE_STAGE_WIDTH : self . obj . stageWidth ;
504+ const maxStageHeight = isFF ( FF_DEV_3793 ) ? RELATIVE_STAGE_HEIGHT : self . obj . stageHeight ;
503505
504506 let { x1, y1, x2, y2 } = Utils . Image . reverseCoordinates ( { x : shape . startX , y : shape . startY } , { x, y } ) ;
505507
506508 x1 = Math . max ( 0 , x1 ) ;
507509 y1 = Math . max ( 0 , y1 ) ;
508- x2 = Math . min ( stageWidth , x2 ) ;
509- y2 = Math . min ( stageHeight , y2 ) ;
510+ x2 = Math . min ( maxStageWidth , x2 ) ;
511+ y2 = Math . min ( maxStageHeight , y2 ) ;
510512
511- shape . setPosition ( x1 , y1 , x2 - x1 , y2 - y1 , shape . rotation ) ;
513+ shape . setPositionInternal ( x1 , y1 , x2 - x1 , y2 - y1 , shape . rotation ) ;
512514 } ,
513515
514516 finishDrawing ( x , y ) {
0 commit comments