File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,10 @@ const DrawArea: FunctionComponent<IDrawArea> = ({
5252 const handleContentMousedown = ( e : any ) => {
5353 if ( ! isDrawMode ) return ;
5454
55- // and set isDrawing to true
5655 const newArea : IgnoreArea = {
5756 id : Date . now ( ) . toString ( ) ,
58- x : e . evt . layerX / stageScale ,
59- y : e . evt . layerY / stageScale ,
57+ x : ( e . evt . layerX - stageOffset . x ) / stageScale ,
58+ y : ( e . evt . layerY - stageOffset . y ) / stageScale ,
6059 width : MIN_RECT_SIDE_PIXEL ,
6160 height : MIN_RECT_SIDE_PIXEL ,
6261 } ;
@@ -77,8 +76,8 @@ const DrawArea: FunctionComponent<IDrawArea> = ({
7776
7877 if ( isDrawing ) {
7978 // update the current rectangle's width and height based on the mouse position + stage scale
80- const mouseX = e . evt . layerX / stageScale ;
81- const mouseY = e . evt . layerY / stageScale ;
79+ const mouseX = ( e . evt . layerX - stageOffset . x ) / stageScale ;
80+ const mouseY = ( e . evt . layerY - stageOffset . y ) / stageScale ;
8281
8382 const newShapesList = ignoreAreas . map ( ( i ) => {
8483 if ( i . id === selectedRectId ) {
Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ const TestDetailsModal: React.FunctionComponent<{
218218 </ Grid >
219219 < Grid item >
220220 < ToggleButton
221+ value = { "drawMode" }
221222 selected = { isDrawMode }
222223 onClick = { ( ) => {
223224 setIsDrawMode ( ! isDrawMode ) ;
You can’t perform that action at this time.
0 commit comments