Page MenuHomeFeedback Tracker

Map display control centre point is not map screen centre point
Closed, ResolvedPublic

Description

Observed: The centre point of the map display control area is not the centre point of the map screen. The causes issues when using ctrlMapScreenToWorld, as [0.5, 0.5] is the center of the screen, not the display control.

Expected: Both the map display and map screen centre should be the same point, as was the case in Arma2OA. Alternatively, the control centre could be moved to the display area centre, but this point is not the centre of the screen.

My terminology might be a bit off, hopefully this makes some sense. {F22760} {F22761}

Details

Legacy ID
2666569465
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Execute the following script in Arma2 and Arma3:

open the map, zoom in, centre map about [1000,1000]
disableSerialization;
openMap [true, false];
waitUntil {visibleMap};
_mapDisplay = findDisplay 12;
_mapCntrl = _mapDisplay displayCtrl 51;
_mapCntrl ctrlMapAnimAdd [1, 0.1, [1000, 1000]];
ctrlMapAnimAdd centres the control centre point, not the map screen.
ctrlMapAnimCommit _mapCntrl;

waitUntil {ctrlMapAnimDone _mapCntrl};
_centre = _mapCntrl ctrlMapScreenToWorld [0.5, 0.5];
systemChat format ["map displayCtrl is centred about point %1", _centre];
systemChat "map display is centred about [1000,1000]";

Additional Information

Event Timeline

ceeeb edited Steps To Reproduce. (Show Details)Nov 15 2013, 7:08 AM
ceeeb edited Additional Information. (Show Details)
ceeeb set Category to Scripting.
ceeeb set Reproducibility to Always.
ceeeb set Severity to None.
ceeeb set Resolution to No Bug.
ceeeb set Legacy ID to 2666569465.May 7 2016, 5:25 PM

Running into the same issue. ctrlMapScreenToWorld [0.5, 0.5] is supposed to return the centre of the map control I am referencing, but it only does that when the map control sits right in the middle of the screen.

Can we please get a fix?

This is not a bug. You assume the map center is [0.5,0.5], but it's not, so the script is incorrect.

The correct solution is to calculate map dimensions dynamically:
_mapCtrl = findDisplay 12 displayCtrl 51;
_center = _mapCtrl ctrlMapScreenToWorld [
(ctrlPosition _mapCtrl select 0) + (ctrlPosition _mapCtrl select 2) * 0.5,
(ctrlPosition _mapCtrl select 1) + (ctrlPosition _mapCtrl select 3) * 0.5
];

This solution will work with every map, no matter what its dimensions are.

Thanks Moricky. BI wiki states [0.5,0.5] is centre (which was apparently true for full screen map as used in OFP->Arma2). I will correct it now.

Mass-closing all resolved issues not updated in the last month.

Please PM me in BI Forums (http://forums.bistudio.com/member.php?55374-Fireball) if you feel your bug was closed in error.