@@ -88,8 +88,6 @@ const CreateShape = (props) => {
8888 // Changes shapeInformation when something in ShapeForm or ShapePreview is altered
8989 const handleChange = ( event , data , number ) => {
9090
91- // console.log(event, data);
92-
9391 const name = event . target . name || event . type ;
9492 const value = event . target . type === "checkbox" ? event . target . checked : event . target . value ;
9593
@@ -131,7 +129,25 @@ const CreateShape = (props) => {
131129 ...shapeInformation ,
132130 "formula" : "polygon(10% 10%, 90% 10%, 90% 90%, 10% 80%)" ,
133131 "vertices" : 4 ,
134- "edges" : 4 ,
132+ "edges" : 4 ,
133+ "verticeCoordinates" : [
134+ {
135+ "x" : "10%" ,
136+ "y" : "10%" ,
137+ } ,
138+ {
139+ "x" : "90%" ,
140+ "y" : "10%" ,
141+ } ,
142+ {
143+ "x" : "90%" ,
144+ "y" : "90%" ,
145+ } ,
146+ {
147+ "x" : "10%" ,
148+ "y" : "80%" ,
149+ } ,
150+ ]
135151 } ) ;
136152 }
137153
@@ -163,7 +179,7 @@ const CreateShape = (props) => {
163179 }
164180
165181 // If DraggableVertice is moved, adjust verticeCoordinates and formula
166- if ( name === "mousemove" ) {
182+ if ( name === "mousemove" || name === "touchmove" ) {
167183
168184 const newVerticeCoordinates = addNewVerticeCoordinates ( data . x , data . y , number ) ;
169185 const newFormula = generateNewFormula ( newVerticeCoordinates ) ;
@@ -193,7 +209,8 @@ const CreateShape = (props) => {
193209 }
194210
195211 // If delete button is pressed and passes a number that corresponds to the vertice, remove the corresponding verticeCoordinate and adjust formula
196- if ( event . target . id . includes ( "deleteButton" ) && number !== undefined ) {
212+ if ( ( event . target . id . includes ( "deleteButton" )
213+ || event . target . parentElement . id . includes ( "deleteButton" ) ) && number !== undefined ) {
197214
198215 let newVerticeCoordinates = [ ] ;
199216
0 commit comments