Snap to integer meters in the level editor when holding shift.
This commit is contained in:
parent
ef3edfcc08
commit
5261a7d4d9
1 changed files with 8 additions and 3 deletions
|
@ -399,9 +399,14 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
thang
|
thang
|
||||||
|
|
||||||
adjustThangPos: (sprite, thang, pos) ->
|
adjustThangPos: (sprite, thang, pos) ->
|
||||||
snap = sprite?.data?.snap or sprite?.thangType?.get('snap') or {x: 0.01, y: 0.01} # Centimeter resolution by default
|
if key.shift
|
||||||
pos.x = Math.round((pos.x - (thang.width ? 1) / 2) / snap.x) * snap.x + (thang.width ? 1) / 2
|
# Meter resolution when holding shift, not caring about thang size.
|
||||||
pos.y = Math.round((pos.y - (thang.height ? 1) / 2) / snap.y) * snap.y + (thang.height ? 1) / 2
|
pos.x = Math.round pos.x
|
||||||
|
pos.y = Math.round pos.y
|
||||||
|
else
|
||||||
|
snap = sprite?.data?.snap or sprite?.thangType?.get('snap') or x: 0.01, y: 0.01 # Centimeter resolution by default
|
||||||
|
pos.x = Math.round((pos.x - (thang.width ? 1) / 2) / snap.x) * snap.x + (thang.width ? 1) / 2
|
||||||
|
pos.y = Math.round((pos.y - (thang.height ? 1) / 2) / snap.y) * snap.y + (thang.height ? 1) / 2
|
||||||
pos.z = thang.depth / 2
|
pos.z = thang.depth / 2
|
||||||
thang.pos = pos
|
thang.pos = pos
|
||||||
thang.stateChanged = true
|
thang.stateChanged = true
|
||||||
|
|
Reference in a new issue