Page MenuHomeFeedback Tracker

ctrlSetScale has no effect on CT_CONTROLS_GROUP
New, NormalPublic

Description

CT_CONTROLS_GROUP child controls are not affected by ctrlSetScale command, while ctrlShow and ctrlSetFade work properly on them.

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce
  1. Start a game with a player
  2. Execute following code:
	if(!isNil"testcontrols") then {{ctrlDelete _x} forEach testcontrols};
	testcontrols = [];

	private _display = findDisplay 46;

	private _group = _display ctrlCreate ["RscControlsGroup", -1];
	_group ctrlSetPosition [0,0,0.7,1];
	_group ctrlCommit 0;

	private _ctrl1 = _display ctrlCreate ["RscText", -1, _group];
	_ctrl1 ctrlSetPosition [0,0,0.5,0.5];
	_ctrl1 ctrlSetBackgroundColor [1,0,0,1];
	_ctrl1 ctrlCommit 0;

	private _ctrl2 = _display ctrlCreate ["RscText", -1, _group];
	_ctrl2 ctrlSetPosition [0.5,0.5,0.5,0.5];
	_ctrl2 ctrlSetBackgroundColor [0,0,1,1];
	_ctrl2 ctrlCommit 0;

	_group ctrlSetScale 0.5;
	_group ctrlSetFade 0.5;
	_group ctrlCommit 1;

	testcontrols pushBack _group;
	testcontrols pushBack _ctrl1;
	testcontrols pushBack _ctrl2;

	logfnc = {
		{systemChat str [diag_frameNo toFixed 0, _x, ctrlType _x, "fade", ctrlFade _x, "scale", ctrlScale _x, "shown", ctrlShown _x]} forEach testcontrols;
	};
	call logfnc;

	0 spawn {
		waitUntil {testcontrols findIf {!ctrlCommitted _x} < 0};

		call logfnc;
	};
  1. Observe that inner controls change fade, but not scale.
Additional Information

Since groups aren't scaled themselves, I see that this can be solved by either of the approaches:

  1. Simply pass scale to child controls so they scale once commited
  2. Since group has also has scale but doesn't do anything, have controls render with scale of their parent group multiplied by their own scale (and group's group if any?)
  3. Most complex, have controls group also scale by itself and scale X/Y and W/H of controls inside it. This is how I always imagined it should work, group is a viewport and should scale both position and size of its child controls.

Event Timeline

SaMatra created this task.Mar 19 2023, 8:44 AM
SaMatra edited Steps To Reproduce. (Show Details)Mar 19 2023, 8:49 AM

On a side note, log function shows group have fade and scale close to 0.5 but not exactly. They're fine on next frame, looks like ctrlCommited return true one frame before animation actually finishes.