seanlowe / obsidian-timelines

Create a timeline view of all notes with the specified combination of tags
https://seanlowe.github.io/obsidian-timelines/
MIT License
39 stars 2 forks source link

Add options to define maximum zoom in and maxiumum zoom out level #30

Closed wanwindwalker closed 2 months ago

wanwindwalker commented 3 months ago

Hours minutes and seconds are unnecessary for most timelines, would be nice if you could limit how much you can zoom in

seanlowe commented 3 months ago

I believe this might be possible with the existing vis-timeline options. I'm going to put some sections of the docs here for future reference.

option name type default description
timeAxis.scale String none Set a fixed scale for the time axis of the Timeline. Choose from 'millisecond', 'second', 'minute', 'hour', 'weekday', 'week', 'day', 'month', 'year'. Example usage: options = { timeAxis: {scale: 'minute', step: 5} }. Note: The 'week' scale only works properly when locales are enabled.
timeAxis.step number 1 Set a fixed step size for the time axis. Only applicable when used together with timeAxis.scale. Choose for example 1, 2, 5, or 10.
zoomable boolean true Specifies whether the Timeline can be zoomed by pinching or scrolling in the window. Only applicable when option moveable is set true.
zoomFriction number 5 Specifies how strong the zooming is for each scroll tick. Higher zooming friction will slow zooming speed.
zoomKey String '' Specifies whether the Timeline is only zoomed when an additional key is down. Available values are '' (does not apply), 'altKey', 'ctrlKey', 'shiftKey' or 'metaKey'. Only applicable when option moveable is set true.
zoomMax number 315360000000000 Set a maximum zoom interval for the visible range in milliseconds. It will not be possible to zoom out further than this maximum. Default value equals about 10000 years.
zoomMin number 10 Set a minimum zoom interval for the visible range in milliseconds. It will not be possible to zoom in further than this minimum.
seanlowe commented 2 months ago

I have added this functionality in Release 2.1.4

You can now add additional filters to the codeblock, zoomInLimit and zoomOutLimit. There is information in the README about how to use the two filters.

Thanks for the suggestion!