Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve scaling response (optically) => with sollution #303

Open
mrAceT opened this issue Oct 9, 2019 · 1 comment
Open

Improve scaling response (optically) => with sollution #303

mrAceT opened this issue Oct 9, 2019 · 1 comment
Assignees

Comments

@mrAceT
Copy link

mrAceT commented Oct 9, 2019

When the size of the mapillary element changes the canvas remains the "old" size for some time.

This is because a higher resolution image needs to be downloaded and/or the canvas needs the be recalculated for the new size. This takes some time which makes the system look a bit sluggish.
Especially when the size of the mapillary gets animated from a relatively small size to a large size the effect is beyond akward.

I fixed this (optically)!
1) I set this in CSS (the container of the canvas)
.mapillary-js-interactive {
height: 100%;
width: 100%;
}
2) Just before I do (and/or detect) the resizing of the window/div I set the canvas (with class 'mapillary-js-canvas') : to
height: 100%;
width: 100%;
3) I call mly.resize(); (after the animation of the resizing is completed!)

The result is that the image of the "old" canvas gets stretched into the new size, that way the complete area remains to be covered with the "old image". When the animation/resizing is complete the new canvas gets calculated.

this can easily be implemented into mapillary-js... no harm done and animation is very exceptable, resulting in an optically more responsive/adaptive feeling :)

PS: you could even go the whole nine yards with calculating the difference in size and alter the percentages accordingly (one at 100% an the other one more, using negative margins to center the image.. haven't done that, yet:P)

PS2: Now that I come to think of it.. why not keep it at 100%/100% by default (for the canvas ant it's container)? I see no reason to force the size of the canvas?

@oscarlorentzon oscarlorentzon self-assigned this Nov 19, 2019
@oscarlorentzon
Copy link
Member

Thanks for reporting.

What browsers do you experience the problems you are seeing in?

Testing with https://bl.ocks.org/oscarlorentzon/raw/5af00c5c07448233bcb62f5e2124ab39/ shows black background at the right and bottom borders briefly when increasing the browser size for me in Firefox only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants