Skip to content

Commit

Permalink
Modified dialog to include distance from last waypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
okopanja committed May 18, 2024
1 parent a0db253 commit d542f2a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions SharkPlanner/UI/CrosshairWindow.dlg
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ dialog = {
},
["type"] = "Static",
},
["ObjectID"] = {
["params"] = {
["bounds"] = {
["x"] = 400 - 150,
["y"] = 200 + 13,
["h"] = 26,
["w"] = 150,
},
["enabled"] = false,
["text"] = "",
["tooltip"] = "Distance from last waypoint",
["visible"] = true,
["zindex"] = 0,
},
["skin"] = {
-- ["params"] = {
-- ["name"] = "buttonSkinAwacs",
-- -- ["name"] = "staticSkin_ME",
-- },
},
["type"] = "Static",
},
["DistanceFromLast"] = {
["params"] = {
["bounds"] = {
Expand Down
5 changes: 5 additions & 0 deletions SharkPlanner/UI/CrosshairWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local Camera = require("SharkPlanner.Base.Camera")
local Position = require("SharkPlanner.Base.Position")
local Mathematics = require("SharkPlanner.Mathematics")
local SkinHelper = require("SharkPlanner.UI.SkinHelper")
local JSON = require("JSON")

local CrosshairWindow = DialogLoader.spawnDialogFromFile(
lfs.writedir() .. "Scripts\\SharkPlanner\\UI\\CrosshairWindow.dlg"
Expand All @@ -31,6 +32,7 @@ function CrosshairWindow:new(o)
local staticCrosshairValueSkin = SkinHelper.loadSkin('staticCrosshairRightLightValue')
local staticCrosshairLightValueSkin = SkinHelper.loadSkin('staticCrosshairRightLightValue')
o.ObjectModel:setSkin(staticCrosshairLightValueSkin)
o.ObjectID:setSkin(staticCrosshairLightValueSkin)
o.DistanceFromLast:setSkin(staticCrosshairValueSkin)
o.Longitude:setSkin(staticCrosshairValueSkin)
o.Latitude:setSkin(staticCrosshairValueSkin)
Expand Down Expand Up @@ -93,8 +95,11 @@ end
function CrosshairWindow:updateObjectModel(eventArgs)
if #eventArgs.objects > 0 then
self.ObjectModel:setText(eventArgs.objects[1].model)
self.ObjectID:setText(eventArgs.objects[1].id)
Logging.debug("Object: "..JSON:encode_pretty(eventArgs.objects[1]))
else
self.ObjectModel:setText("")
self.ObjectID:setText("")
end
end

Expand Down

0 comments on commit d542f2a

Please sign in to comment.