File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -297,13 +297,26 @@ const CreateShape = (props) => {
297297
298298 // Returns an array that has a new verticeCoordinate
299299 const addNewVerticeCoordinates = ( x , y , number ) => {
300- const xPercentage = Math . round ( ( x / 280.0 ) * 100.0 ) ;
301- const yPercentage = Math . round ( ( y / 280.0 ) * 100.0 ) ;
300+
301+ let xValue ;
302+ let yValue ;
303+
304+ if ( shapeInformation . verticeCoordinates [ number ] . x . includes ( "%" ) ) {
305+ xValue = Math . round ( ( x / 280.0 ) * 100.0 ) + "%" ;
306+ } else if ( shapeInformation . verticeCoordinates [ number ] . x . includes ( "px" ) ) {
307+ xValue = Math . round ( x ) + "px" ;
308+ }
309+
310+ if ( shapeInformation . verticeCoordinates [ number ] . y . includes ( "%" ) ) {
311+ yValue = Math . round ( ( y / 280.0 ) * 100.0 ) + "%" ;
312+ } else if ( shapeInformation . verticeCoordinates [ number ] . y . includes ( "px" ) ) {
313+ yValue = Math . round ( y ) + "px" ;
314+ }
302315
303316 let newVerticeCoordinates = shapeInformation . verticeCoordinates ;
304317 newVerticeCoordinates [ number ] = {
305- "x" : xPercentage + "%" ,
306- "y" : yPercentage + "%"
318+ "x" : xValue ,
319+ "y" : yValue
307320 }
308321
309322 return newVerticeCoordinates ;
You can’t perform that action at this time.
0 commit comments