You are not logged in.

Tuur

Sage

  • "Tuur" started this thread

Posts: 3,154

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

1

Thursday, March 6th 2014, 2:44pm

Dragging one direction

Hi,

i'm playing a bit and i have this x only dragging of a layer.
I like to make it that it only is possible to drag to the left.. so x minus value.

here is my code..
what to change to make it only possible to drag to the left?
the layer is aligned centre. x=0

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
	<action name="draglayer">
		if(%1 != dragging,

			copy(drag_currentx, x);
			copy(drag_stagex, mouse.stagex);
			set(drag_sx, +1);
			draglayer(dragging);
		  ,
			if(pressed,
				
				sub(dx, mouse.stagex, drag_stagex);
				mul(dx, drag_sx);
				add(x, drag_currentx, dx);
				delayedcall(0, move(); draglayer(dragging) );
				
				
			  );
		  );
	</action>


i tried somethings like if(x LT 1, etc on different places .. but no success..
Anybody?

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

2

Thursday, March 6th 2014, 3:28pm

Source code

1
2
3
4
5
6
7
			if(pressed,	
				sub(dx, mouse.stagex, drag_stagex);
				if(dx LT 0,
					add(x, drag_currentx, dx);
				);
				delayedcall(0, move(); draglayer(dragging) );				
			  );


Or am I getting you wrong?

Tuur

Sage

  • "Tuur" started this thread

Posts: 3,154

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

3

Thursday, March 6th 2014, 3:32pm

No…
you getting me right *g*
i was almost there i see…

Thank you 'do!
learned something again.

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

Alexey Tkachenko

Professional

Posts: 742

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

4

Thursday, March 6th 2014, 3:37pm

this works:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<action name="draglayer">
		if(%1 != dragging,
			copy(drag_currentx, x);
			copy(drag_stagex, mouse.stagex);
			set(drag_sx, +1);
			draglayer(dragging);
		  ,
			if(pressed,
				sub(dx, mouse.stagex, drag_stagex);
				mul(dx, drag_sx);
				if(dx LT x, add(x, drag_currentx, dx););
				delayedcall(0, move(); draglayer(dragging) );	
			  );
		  );
	</action>
Regards,

Alexey

Alexey Tkachenko

Professional

Posts: 742

Location: Sevastopol, Crimea, Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

5

Thursday, March 6th 2014, 3:37pm

Oh, sorry, already answered)) hehe *smile* *smile*
Regards,

Alexey

Tuur

Sage

  • "Tuur" started this thread

Posts: 3,154

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

6

Thursday, March 6th 2014, 3:39pm

yes but yours is a bit different.
Which could also be possible to use.. but not in my case for now.

Thanx guys!
Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur