Final zone label offset fix.

This commit is contained in:
iTracerFacer 2025-11-05 09:25:31 -06:00
parent b1e3c687ae
commit 65eae0a317
3 changed files with 18 additions and 13 deletions

View File

@ -193,9 +193,11 @@ CTLD.Config = {
Drop = 2, -- dashed
FOB = 4, -- dot-dash
},
-- Label placement tuning
LabelOffset = 0, -- meters beyond the zone radius to place the label (12 o'clock)
LabelOffsetX = 200, -- meters: horizontal nudge; adjust if text appears left-anchored in your DCS build
-- Label placement tuning (simple):
-- Effective extra offset from the circle edge = r * LabelOffsetRatio + LabelOffsetFromEdge
LabelOffsetFromEdge = 0, -- meters beyond the zone radius to place the label (12 o'clock)
LabelOffsetRatio = 0.0, -- fraction of the radius to add to the offset (e.g., 0.1 => +10% of r)
LabelOffsetX = 200, -- meters: horizontal nudge; adjust if text appears left-anchored in your DCS build
-- Per-kind label prefixes
LabelPrefixes = {
Pickup = 'Supply Zone',
@ -504,9 +506,10 @@ function CTLD:_drawZoneCircleAndLabel(kind, mz, opts)
trigger.action.circleToAll(side, circleId, p, r, outline, fill, lineType, readOnly, "")
local label = string.format('%s: %s', labelPrefix, zname)
-- Place label centered above the circle (12 o'clock). Horizontal nudge via LabelOffsetX.
local extra = (opts.LabelOffset ~= nil) and opts.LabelOffset or 30
-- Simple formula: extra offset from edge = r * ratio + fromEdge
local extra = (r * (opts.LabelOffsetRatio or 0.0)) + (opts.LabelOffsetFromEdge or 30)
local nx = p.x + (opts.LabelOffsetX or 0)
local nz = p.z - (r + extra)
local nz = p.z - (r + (extra or 0))
local textPos = { x = nx, y = 0, z = nz }
trigger.action.textToAll(side, textId, textPos, {1,1,1,0.9}, {0,0,0,0}, fontSize, readOnly, label)
-- Track ids so they can be cleared later
@ -556,8 +559,9 @@ function CTLD:SetZoneActive(kind, name, active, silent)
LineType = (md.LineTypes and md.LineTypes[k]) or md.LineType or 1,
FontSize = md.FontSize,
ReadOnly = (md.ReadOnly ~= false),
LabelOffset = md.LabelOffset,
LabelOffsetX = md.LabelOffsetX,
LabelOffsetFromEdge = md.LabelOffsetFromEdge,
LabelOffsetRatio = md.LabelOffsetRatio,
LabelPrefix = ((md.LabelPrefixes and md.LabelPrefixes[k])
or (k=='Pickup' and md.LabelPrefix)
or (k..' Zone'))
@ -588,8 +592,9 @@ function CTLD:DrawZonesOnMap()
FontSize = md.FontSize,
ReadOnly = (md.ReadOnly ~= false),
LabelPrefix = md.LabelPrefix or 'Zone',
LabelOffset = md.LabelOffset,
LabelOffsetX = md.LabelOffsetX,
LabelOffsetFromEdge = md.LabelOffsetFromEdge,
LabelOffsetRatio = md.LabelOffsetRatio,
ForAll = (md.ForAll == true),
}
if md.DrawPickupZones then

Binary file not shown.

View File

@ -23,9 +23,9 @@ ctldBlue = _MOOSE_CTLD:New({
-- Optional: drive zone activation from mission flags (preferred: set per-zone below via flag/activeWhen)
Zones = {
PickupZones = { { name = 'Blue_PickupZone_1', smoke = trigger.smokeColor.Blue, flag = 9001, activeWhen = 0 } },
DropZones = { { name = 'ALPHA-1', flag = 9002, activeWhen = 0 } },
FOBZones = { { name = 'FOB-1', flag = 9003, activeWhen = 0 } },
PickupZones = { { name = 'ALPHA', smoke = trigger.smokeColor.Blue, flag = 9001, activeWhen = 0 } },
DropZones = { { name = 'BRAVO', flag = 9002, activeWhen = 0 } },
FOBZones = { { name = 'CHARLIE', flag = 9003, activeWhen = 0 } },
},
BuildRequiresGroundCrates = true,
})
@ -40,9 +40,9 @@ ctldRed = _MOOSE_CTLD:New({
-- Optional: drive zone activation for RED via per-zone flag/activeWhen
Zones = {
PickupZones = { { name = 'Red_PickupZone_1', smoke = trigger.smokeColor.Red, flag = 9101, activeWhen = 0 } },
DropZones = { { name = 'ALPHA-2', flag = 9102, activeWhen = 0 } },
FOBZones = { { name = 'FOB-2', flag = 9103, activeWhen = 0 } },
PickupZones = { { name = 'DELTA', smoke = trigger.smokeColor.Red, flag = 9101, activeWhen = 0 } },
DropZones = { { name = 'ECHO', flag = 9102, activeWhen = 0 } },
FOBZones = { { name = 'FOXTROT', flag = 9103, activeWhen = 0 } },
},
BuildRequiresGroundCrates = true,
})