Hi all, this is my first post on this forum. I am working on a mobile calendar which requires to manage a large horizontal drag area combined to a important vertical scroll for a mobile web application (in webkit browser : Safari / Chrome) You will find a mockup attached to this post in order to understand what i am trying to do.
This calendar has : - on left side : a vertical list of people (called "fixedView") - on right side : a vertical list of blocks which has a horizontal scrollview (using Draggable) in order to swich days by using drag gesture on axis : x (called "InnerView") These two sides are embedded in a "mainView" which is the page container for calendar. (Please have a look to attached file). In fact, i am trying to use a horizontal Draggable (InnerView) into a container which has a vertical scroll (mainView) I made a lot of research , check mobile performances (Galaxy S3 mini to iPhone5) and tests to try : "Scroll In Scroll" : Adding a vertical Draggable for mainView + Adding a horizontal Draggable for InnerView
it "works badly" but don't know how to control vertical & horizontal in order to "lockAxis"; right now you can do diagonal drag which is not good (and bad perfs of course)
moreover : with this method, i removed native scroll (provide by webkit with -webkit-overflow-scrolling: touch; which brings low perfs on vertical scroll
=> My Conclusions :using Greensock Draggable to manage vertical scroll is not possible cause we have very bad perfs on low devices
I have to use native scroll provided by webkit for vertical scroll (best perfs.) and use Draggable for horizontal scroll (in InnerView) only
Do you agree ? So, this is the problem i can't resolve : When i create a new Draggable for InnerView (params below) with {type : "x"}, i can't do a vertical scroll anymore (for sure). What i would like to do is to detect when user is doing a horizontal or vertical scroll on InnerView (by a swipe or drag gesture) .
If User is scrolling horizontaly => we use Draggable Instance for InnerView only
if User starts scrolling verticaly => we use a "prevent default" for Dragable to release touch bind and so let the browser do a native vertical scroll (webkit)
So for this 2nd point, i don't know how to do this. (I had a look on google, GSAP forums, Docs...) I tried to bind the event with onDragStart method but didn't get it. Do you this this is the right approach ? I cant use a Draggable instance with {type : "x,y"} because it would mean that only "InnerView" will scroll vertically but in our case we need to scroll the entire mainview (which include FixedView + InnerView => so the mainView
I had a look to "scrollLeft" and "scrollTop" properties and several code pens but i am still blocked. Hope my post is understandable; if you need more details, do not hesitate.
Here Draggable Instance for InnerView :
innerView = Draggable.create(innerViewEl, {
type : "x",
bounds : targetStageEl,
throwProps : true,
force3D : params.stage.force3D,
edgeResistance : params.stage.edgeResistance,
dragResistance : params.stage.dragResistance,
// dragClickables : true,
lockAxis : true,
// zIndexBoost : false,
snap: {
x: function(endValue) {
return Math.round(endValue / contextInterface._width) * contextInterface._width;
}
}
});
Here DraggableInstance for MainView (bad perf for vertical scroll)
mainView = Draggable.create(mainViewEl, {
type : "y",
bounds : {minY:0, maxY:-3000}, //SimulateLongScroll
throwProps : true,
force3D : false, // params.stage.force3D,
edgeResistance : params.stage.edgeResistance,
dragResistance : params.stage.dragResistance,
dragClickables : true,
lockAxis : true
});
Thanks in advance.