@@ -218,17 +218,19 @@ function tickUnabstractionMode() {
218
218
floatingComponent . components . forEach ( component => {
219
219
components . push ( component ) ;
220
220
221
- deltaX += component . x ;
222
- deltaY += component . y ;
221
+ deltaX += component . targetX ;
222
+ deltaY += component . targetY ;
223
223
} ) ;
224
224
wires . push ( ...floatingComponent . wires ) ;
225
225
226
- deltaX = floatingComponent . x - Math . round ( deltaX / floatingComponent . components . length ) ;
227
- deltaY = floatingComponent . y - Math . round ( deltaY / floatingComponent . components . length ) ;
226
+ deltaX = floatingComponent . targetX - Math . round ( deltaX / floatingComponent . components . length ) ;
227
+ deltaY = floatingComponent . targetY - Math . round ( deltaY / floatingComponent . components . length ) ;
228
228
229
229
floatingComponent . components . forEach ( component => {
230
- component . x += deltaX ;
231
- component . y += deltaY ;
230
+ component . x = floatingComponent . x + floatingComponent . size / 2 ;
231
+ component . y = floatingComponent . y + floatingComponent . size / 2 ;
232
+ component . targetX += deltaX ;
233
+ component . targetY += deltaY ;
232
234
component . reposition ( ) ;
233
235
} ) ;
234
236
}
@@ -337,8 +339,9 @@ function tickCloneMode() {
337
339
let clonedComponents = [ ] ;
338
340
clonedStrings . forEach ( strings => {
339
341
let component = structify ( strings , camera ) ;
340
- component . x = component . x - x1 - halfWidth + inGameX ;
341
- component . y = component . y - y1 - halfHeight + inGameY ;
342
+ component . setPos ( component . targetX - x1 - halfWidth + inGameX , component . targetY - y1 - halfHeight + inGameY ) ;
343
+ component . x = component . targetX ;
344
+ component . y = component . targetY ;
342
345
component . reposition ( ) ;
343
346
component . calculate ( ) ;
344
347
clonedComponents . push ( component ) ;
0 commit comments