Jump to content
Kingsley1997

Map control not positioned correctly using ctrlCreate

Recommended Posts

I'm creating a map control using ctrlCreate but it's not positioning correctly, at least not visually. The orange box is a static background control with the same position the map control is given. So the position is correct, but the map doesn't work with it :S

 

Source code:

https://github.com/marseditor/mars/blob/master/addons/attributes/functions/fnc_ctrlMap.sqf

https://github.com/marseditor/mars/blob/master/addons/common/UI/Controls/ctrlMap.hpp

 

Reference images:

1761760aa373b896e72a0d5367be22d4.png
https://gyazo.com/1761760aa373b896e72a0d5367be22d4

 

This in particular is interesting. It's technically positioned correctly, but not the image...

https://gyazo.com/1e9580f95f7e2d2c06c2cc2c7a512232

Share this post


Link to post
Share on other sites

Could be caused by the fact that maps cannot be in controls groups. Engine treats them a bit differently because of how complex they are.

Share this post


Link to post
Share on other sites

Could be caused by the fact that maps cannot be in controls groups. Engine treats them a bit differently because of how complex they are.

Omitting the control group param in ctrlCreate still produces the same problem.

Share this post


Link to post
Share on other sites

And since the map is not in controls group, you need to position it in screen coordinates, not in local positions relative to group's left corner.

  • Like 1

Share this post


Link to post
Share on other sites

Are there any commands to convert a controls relative position to its group to screen coordinates?

Share this post


Link to post
Share on other sites


_position set [0, (_position select 0) + (_controlGroupPos select 0)];

_position set [1, (_position select 1) + (_controlGroupPos select 1)];

_position set [3, (_position select 2)];

_ctrlMap ctrlSetPosition _position;

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×