CT_CONTROLS_GROUP child controls are not affected by ctrlSetScale command, while ctrlShow and ctrlSetFade work properly on them.
Description
Description
Details
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- N/A
- Operating System
- Windows 10 x64
- Category
- Scripting
Steps To Reproduce
- Start a game with a player
- 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; };
- 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:
- Simply pass scale to child controls so they scale once commited
- 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?)
- 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
Comment Actions
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.