Jump to content
Sign in to follow this  
drunken officer

problems with the mapzoom inside a dialog

Recommended Posts

I've a dialog and the most things working fine..

The first thing i'm not understanding is, that when i start the dialog by addaction, the map inside is zoomable by mousewheel. If i start the dialog by comm menu or radio trigger, i can only zoom by numpad (+/-)

So thats why i want to add a vertical slider fot zoom. I'm adding a slider and style = SL_VERT;type = 43;I cant see the slider. If i change the style to SL_HORZ, i can see the slider.

But the most importing thing is, can somebody explain to me, how can i zoom a map with a slider. I test it by an script, but without success.

descrition.ext:

...

#include "DOF_AAS\DOFARTY_defines.hpp"

#include "DOF_AAS\DOFArty_dialog.hpp"

DOF_Arty_defines

class DOFARTY_RscXSliderH

{

style = 1024;

type = 3;

shadow = 2;

x = 0;

y = 0;

h = 0.029412;

w = 0.400000;

//color[] = {1, 1, 1, 0.7}; weiß

color[] = {0.804,0.773,0.749,1};

colorActive[] = {1, 1, 1, 1};

colorDisabled[] = {1, 1, 1, 0.500000};

arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";

arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";

border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";

thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa";

};

class DOFARTY_RscXSliderV

{

style = SL_VERT;

type = 43;

shadow = 2;

x = 0;

y = 0;

h = 0.45;

w = 0.06;

color[] = {0.804,0.773,0.749,1};

colorActive[] = {1, 1, 1, 1};

colorDisabled[] = {1, 1, 1, 0.500000};

arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";

arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";

border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";

thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa";

};

...

class DOFARTY_RscMapControl

{

... defintion of a map ...

};

DOF_Arty_dialog

...
class controls 	{	 	

	   class DOF_MAP: DOFARTY_RscMapControl
	  {
			idc = DOF_SUPPORT_Map;
		 x = 0.3 + 0.185;
		 y = 0 + (11 / 50);
		 w	= 0.51;
		h	= 0.6; 
		onMouseZChanged = "";
		onMouseButtonDown = "'"; 
	};

class DOF_zoom_slider : DOFARTY_RscXSliderH 
	{
		idc = 203;
		type = 43; 
		tooltip = "";
		x = 1.2;
		y = 1.1;
		w = 0.45 h = 0.06;
		onSliderPosChanged = "DOF_ZOOM =  format ['%1', (_this select 1)]; hint str dof_zoom "; //
		onMouseZChanged = ""; 
	};
[b]//DOFARTY_RscXSliderV  doesnt works[/b] :confused:

testscript

waituntil {sleep 0.5; dialog};
DOF_ZOOM = 1;
slidersetRange [203,0.01,1];
sliderSetPosition [203, DOF_ZOOM];

_ctrl = DOFARTY_RscMapControl displayctrl DOF_SUPPORT_Map;
_ctrl ctrlmapanimadd [0.1, DOF_ZOOM, (getPos Player)]; // show home base
 ctrlmapanimcommit _ctrl;

Edited by Drunken Officer

Share this post


Link to post
Share on other sites

Although it doesn't exactly solve your problem with the slider that zooms the map, I still thought I post what I have found here, first because it's a similar issue and second because I would not have been able to achieve it if not for this post.

Long story short, I managed to make the dialog map zoomable with the mouse wheel, although it's not perfect which you'll see if you decide to test this.

this is the code I use in my OnLoad.sqf (executed onLoad).

mouse_position_2d = _ctrl_map ctrlAddEventHandler ["MouseMoving", 
"

_dialog = findDisplay 1200;
_ctrl_map = _dialog displayCtrl 1300;

_mouse_position_x = _this select 1;
_mouse_position_y = _this select 2;


_position = _ctrl_map ctrlMapScreenToWorld [_mouse_position_x, _mouse_position_y];
position_2d_array_world = [_position select 0, _position select 1];

"
];

zoom_map = _ctrl_map ctrlAddEventHandler ["MouseZChanged",
"
_dialog = findDisplay 1200;
_ctrl_map = _dialog displayCtrl 1300;
mapscale = ctrlMapScale _ctrl_map;

if ((_this select 1) <= 0) then {
mapscale = mapscale * 0.8;
}

else {
mapscale = mapscale * 1.2;
};

_ctrl_map ctrlMapAnimAdd [0, mapscale, position_2d_array_world];
ctrlMapAnimCommit _ctrl_map;
"
];

the problem is that ctrlMapAnimAdd sets the selected position to zoom to in the middle of the map control, so if the point you're zooming to is not exactly in the middle the map will "jump". Now the coursor isn't pointed to location you originally intended to zoom to, and if you move your mouse now the position_2d_array_world will update and the next zoom step will be to a location you didn't intended to zoom to. this means if you use this method you'll have to get used to a slightly different way of zooming the map.

Anyways, I still hope this can be useful, at least it'll be for me.

Share this post


Link to post
Share on other sites

Up !!!

Anyone for this problem ??

 

I'd would like to find a solution, to be able to zoom with the mousewheel !!

 

Help :(

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
Sign in to follow this  

×