Page MenuHomeFeedback Tracker

ctrlMapAnimAdd does not work properly
Closed, ResolvedPublic

Description

When using it on a map control which was created with ctrlCreate and its position and size does not cover the whole screen, the position set in ctrlMapAnimAdd has an offset.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce
  1. Create a mission in the editor
  2. Place a player and press preview
  3. Execute the following code from the debug console
[] spawn 
{
  disableSerialization;

  private _display = (call BIS_fnc_displayMission) createDisplay "DisplaySimulated";
  private _ctrlMap = _display ctrlCreate ["RscMapControl", -1];
  _ctrlMap ctrlSetPosition [0, 0, 1, 1];
  _ctrlMap ctrlCommit 0;

  for "_i" from 0 to 8 do
  {
    private _rndPos = [] call BIS_fnc_randomPos;
    private _marker = createMarker ["testMarker_" + str _i, _rndPos]; // Not visible yet.
    _marker setMarkerType "hd_dot"; // Visible.

    _ctrlMap ctrlMapAnimAdd [0.8, ctrlMapScale _ctrlMap, _rndPos];
    ctrlMapAnimCommit _ctrlMap;
    waitUntil {ctrlMapAnimDone _ctrlMap};
    systemChat "Next animation in 3 seconds!";
    sleep 1;
    if (_i == 4) then
    {
      systemChat "Now with a map control which covers the whole screen!";
      systemChat "See how map is now properly centered on the markers!";
      _ctrlMap ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH];
      _ctrlMap ctrlCommit 1;
      waitUntil {ctrlCommitted _ctrlMap};
    };
  };

  ctrlDelete _ctrlMap;
};

First four markers show how the command is bugged. After that, the map gets resized and the positions are displayed correctly.

Event Timeline

R3vo created this task.May 23 2021, 10:45 AM
R3vo edited Steps To Reproduce. (Show Details)
R3vo edited Steps To Reproduce. (Show Details)May 23 2021, 10:48 AM
BIS_fnc_KK changed the task status from New to Confirmed Internally.

nice repro indeed

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.May 24 2021, 11:28 AM
BIS_fnc_KK changed the task status from Confirmed Internally to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.
R3vo closed this task as Resolved.Jul 8 2021, 5:01 PM
R3vo claimed this task.

Works nicely. Tested with

[] spawn 
{
  disableSerialization;

  private _display = (call BIS_fnc_displayMission) createDisplay "DisplaySimulated";
  private _ctrlMap = _display ctrlCreate ["RscMapControl", -1];
  _ctrlMap ctrlMapSetPosition [0, 0, 1, 1];
  allMapMarkers apply {deleteMarker _x};
  for "_i" from 0 to 8 do
  {
    private _rndPos = [] call BIS_fnc_randomPos;
    private _marker = createMarker ["testMarker_" + str _i, _rndPos]; // Not visible yet.
    _marker setMarkerType "hd_dot"; // Visible.

    _ctrlMap ctrlMapAnimAdd [0.8, ctrlMapScale _ctrlMap, _rndPos];
    ctrlMapAnimCommit _ctrlMap;
    waitUntil {ctrlMapAnimDone _ctrlMap};
    systemChat "Next animation in 3 seconds!";
    sleep 1;
    if (_i == 4) then
    {
      systemChat "Now with a map control which covers the whole screen!";
      systemChat "See how map is now properly centered on the markers!";
      _ctrlMap ctrlMapSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH];
      waitUntil {ctrlCommitted _ctrlMap};
    };
  };

  ctrlDelete _ctrlMap;
};