On swipe twice in the same scene


(Lukas) #1

Hi,

I’ve created 100 scene website / presentation. They all need to work with onSwipe (next scene, previous, sometimes swipe needs to go to a specific scene). I also have a menu as a persistent symbol on every scene. Menu is hidden and covering 100% of the scene when visible. Menu also needs to support scrolling (vertical and horizontal) but when I scroll scenes on the layer below the menu changes… Any ideas how to stop onSwipe when persistent symbol is visible?


(Jonathan Deutsch) #2

My best recommendation would be to put an ‘On Drag’ action on the persistent symbol that runs javascript (though the javascript can be blank). Then the symbol will get the events and swipes won’t occur. When the persistent symbol is removed from the view the area should all be swipable.


(Lukas) #3

Thanks jonathan,
It does work ok but I’ve noticed onDrag action executes javascript I use for touch events about 60-70 times. This slows things down massively…

function column_onDrag(hypeDocument, element, event) {

	if(event['hypeGesturePhase']=='start'){
 		if(window.startInt==undefined){
			window.startInt = event.hypeGestureYPosition;
 		}
	}
	
	if(event['hypeGesturePhase']=='move') {
   
		if((event.hypeGestureYPosition > window.startInt) && window.onlyonce==undefined){
			window.onlyonce=true;
			$(element.id).animate({ scrollTop: '+=115' }, 500);
		}
		if((event.hypeGestureYPosition < window.startInt) && window.onlyonce==undefined){
			window.onlyonce=true;
			$(element.id).animate({ scrollTop: '-=115' }, 500);
		}
	
	}
	if(event['hypeGesturePhase']=='end'){
		window.onlyonce=undefined;
		window.startInt = event.hypeGestureYPosition;
	}
}

(Mark Hunte) #4

That would only happen if it is set to do so?


(Lukas) #5

Maybe it is because it’s a persistent symbol available on all scenes?


(Mark Hunte) #6

It is easier for us to see if we can see an example of your setup…
Can you post something that does not contain everything but includes the main setup


(Jonathan Deutsch) #7

Yeah, I’d like to see an example. The On Drag I was suggesting would basically be a no-op… it would be called a lot but not really doing anything in your case. However it looks like you are actually trying to do something in the code you sent.