Our pure JavaScript Scheduler component


Post by dcporter »

I'm trying to disable zooming and snapping to hours. I've set the maxZoomLevel to 10 so that you can't zoom so far as to see hours in the header. I've also set snap to true. However, it still snaps at the hour level.

If I set the maxZoomLevel to 9, it successfully snaps at a day level, however the header shows the days of the week instead of the dates, which I need. How can I completely prevent snapping to hours?

Post by pmiklashevich »

Basically zooming feature changes active view preset. So what you need is to carefully specify the view preset(s) or choose from predefined view presets. Then list all zoom levels you want to have. Please try out this code in basic demo:
viewPreset : {
    name           : 'dayAndWeek',
    timeResolution : {
        unit      : 'day',
        increment : 1
    }
},

zoomLevels : [
    { name : 'Preset1', preset : 'dayAndWeek', width : 50, increment : 4, resolution : 1, resolutionUnit : 'day' },
    { name : 'Preset2', preset : 'dayAndWeek', width : 60, increment : 3, resolution : 1, resolutionUnit : 'day' },
    { name : 'Preset3', preset : 'dayAndWeek', width : 80, increment : 2, resolution : 1, resolutionUnit : 'day' },
    { name : 'Preset4', preset : 'dayAndWeek', width : 100, increment : 1, resolution : 1, resolutionUnit : 'day' }
],

listeners : {
    zoomchange({ level }) {
        console.log(level.name);
    }
},
Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply