mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	Merge branch 'master' of https://github.com/tobspr/shapez.io
This commit is contained in:
		
						commit
						989347d0ea
					
				| @ -92,6 +92,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { | ||||
|          */ | ||||
|         this.currentDirectionLockSide = 0; | ||||
| 
 | ||||
|         /** | ||||
|          * Whether the side for direction lock has not yet been determined. | ||||
|          * @type {boolean} | ||||
|          */ | ||||
|         this.currentDirectionLockSideIndeterminate = true; | ||||
| 
 | ||||
|         this.initializeBindings(); | ||||
|     } | ||||
| 
 | ||||
| @ -204,6 +210,17 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { | ||||
|         const worldPos = this.root.camera.screenToWorld(mousePosition); | ||||
|         const mouseTile = worldPos.toTileSpace(); | ||||
| 
 | ||||
|         // Figure initial direction
 | ||||
|         const dx = Math.abs(this.lastDragTile.x - mouseTile.x); | ||||
|         const dy = Math.abs(this.lastDragTile.y - mouseTile.y); | ||||
|         if (dx === 0 && dy === 0) { | ||||
|             // Back at the start. Try a new direction.
 | ||||
|             this.currentDirectionLockSideIndeterminate = true; | ||||
|         } else if (this.currentDirectionLockSideIndeterminate) { | ||||
|             this.currentDirectionLockSideIndeterminate = false; | ||||
|             this.currentDirectionLockSide = dx <= dy ? 0 : 1; | ||||
|         } | ||||
| 
 | ||||
|         if (this.currentDirectionLockSide === 0) { | ||||
|             return new Vector(this.lastDragTile.x, mouseTile.y); | ||||
|         } else { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user