bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

Add touch swipe navigation to Calendar Day / Week / Month / Year views #2344

Open pmiklashevych opened 3 years ago

pmiklashevych commented 3 years ago

Requested here: https://www.bryntum.com/forum/viewtopic.php?p=82433#p82433

CalendarDrag feature should use longpress to initiate drag. On swipe event call Calendar.shiftNext() / Calendar.shiftPrevious().

ExtAnimal commented 3 years ago

As a foundational matter, we need a gesture recognition layer so that we can simply detect "swipe", "pinch", "zoom", "rotate" etc.

Then it would be as simple as

EventHelper.on({ 
    element : this.element,
    swipe   : 'up.onElementSwipe',
    thisObj : this
});

And onElementSwipe would just call previous or next depending on the direction property of the passed generated event.

In terms of the visual effect, @dongryphon is creating an animation utility. We can produce a visual swipe effect similar to how Google Calendar does it. It basically fades the view out, then runs 2 animations at once: fade in, and also slide in but just the last ~200 pixels of the slide to give the impression of it appearing from the expected side.

dongryphon commented 1 month ago

See also: