Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
mc-oofert committed Apr 13, 2024
1 parent 135a00c commit d34492e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/app/ui/cpwsarea/wsmap/tools/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
// ToolMove can be used move a single object.
type ToolMove struct {
tool
instance *dmminstance.Instance
lastTile *dmmap.Tile
instance *dmminstance.Instance
lastTile *dmmap.Tile
lastMouseCoords imgui.Vec2
lastOffsets [2]int
lastOffsets [2]int
}

func (ToolMove) Name() string {
Expand Down Expand Up @@ -65,18 +65,18 @@ func (t *ToolMove) process() {
}
origPrefab := t.instance.Prefab()
mouseCoords := imgui.MousePos()
offsetX := (mouseCoords.X - t.lastMouseCoords.X) / ed.ZoomLevel()
offsetY := (t.lastMouseCoords.Y - mouseCoords.Y) / ed.ZoomLevel()
offsetX := (mouseCoords.X - t.lastMouseCoords.X) / ed.ZoomLevel()
offsetY := (t.lastMouseCoords.Y - mouseCoords.Y) / ed.ZoomLevel()

newVars := dmvars.Set(origPrefab.Vars(), xAxis, strconv.Itoa(t.lastOffsets[0] + int(offsetX)))
newVars = dmvars.Set(newVars, yAxis, strconv.Itoa(t.lastOffsets[1] + int(offsetY)))
newVars := dmvars.Set(origPrefab.Vars(), xAxis, strconv.Itoa(t.lastOffsets[0]+int(offsetX)))
newVars = dmvars.Set(newVars, yAxis, strconv.Itoa(t.lastOffsets[1]+int(offsetY)))
t.instance.SetPrefab(dmmprefab.New(dmmprefab.IdNone, origPrefab.Path(), newVars))

ed.UpdateCanvasByCoords([]util.Point{t.instance.Coord()})
}

func (t *ToolMove) onMove(coord util.Point) {
if(t.instance == nil || imguiext.IsShiftDown()) {
if t.instance == nil || imguiext.IsShiftDown() {
return
}

Expand Down

0 comments on commit d34492e

Please sign in to comment.