P
P
Pavel K2015-12-25 18:08:48
JavaScript
Pavel K, 2015-12-25 18:08:48

How to implement “zoom” on the canvas, for example, from a year to a specific day of the week?

Hello again!
I'm doing something like a timeline / calendar grid
vyJhphfl.jpg
here in columns - the days for each month
in these days should be broken down by hours and minutes.
You need to make a "zoom" i.e. so that the columns become larger and you can see hours in them, then minutes in hours.
Before that, I just did a complete redrawing of the canvas for the current day, displaying a breakdown of time without neighboring days.
The customer now doesn’t want this at all, but wants to have a “zoom”
17zS_Q4Z8dc.jpg
so that without switching immediately to per-minute he could see the hours when the minutes are not important, and when they are important, still zoom and scroll right in such a zoom to other days.
How to approach this correctly and from which side to approach?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yuri, 2015-12-25
@riky

I think for this it’s better to look at svg
d3js - the framework is quite complicated, but they have a million examples and ready-made blanks + docks, you can also do it with beautiful animation.

S
Stanislav Makarov, 2015-12-25
@Nipheris

And what is there to think. Well, enter some kind of zoom symbol, for example, 1 is the minimum increase, as it is now. Also enter a point - the center of the viewport where the user is looking. Depending on the scale value, draw days/hours or minutes. Draw only what is visible through the viewport. Thus, you will get a long, long calendar, at each moment in time you will see only a fragment of it. Well how tile maps are done.

T
trushka, 2015-12-26
@trushka

Maybe do it on regular html, according to the principle from the previous answer? In order not to make it heavier, with insufficient zoom, hide smaller elements using display:none, and show only within the viewport.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question