search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

position selected event on the center of view port when zoom in/out

Asked by Suman
4 years ago.

Hi,
I would like to have a feature that when a event is selected and zoom is applied, that event would be positioned to the center of the scheduler view port.

Thanks
Suman

Answer posted by Dan Letecky [DayPilot]
4 years ago.

You can scroll to a specified position using scrollTo() method:
https://api.daypilot.org/daypilot-scheduler-scrollto/

You can get the selected event using multiselect.events():
https://api.daypilot.org/daypilot-scheduler-multiselect-events/

var event = dp.multiselect.events()[0];
if (event) {
  var mid = event.start().addTime((event.end().getTime() - event.start().getTime())/2);
  dp.scrollTo(mid, "fast", "middle");
}
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.