Pan limits flickers #6835
victorlmneves
started this conversation in
General
Replies: 1 comment 1 reply
-
Let me see if i can update the page naming variables in a way that is more clear |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I'm testing Fabric after testing Konva and I found at least one feature on Fabric that is 100% better than Konva that is the Textbox that allows to edit the text without the need of hiding the text element and show a textarea in his place, that works more os less fine, even so, we need to lots os calculations in order to make it appear in the same position where the text element so the user doesn't see the switch, even so, it doesn't allow us to apply different styles on the sentence.
But there also a demo that caught my attention, the one where the user can't pan the canvas besides his limits. After looking at the code of the example, I'm with some doubts about some values used in the calculation, and I would like to see anyone could help.
http://fabricjs.com/fabric-intro-part-5
if (zoom < 400 / 1000) {
vpt[4] = 200 - 1000 * zoom / 2
else if (vpt[4] < canvas.getWidth() - 1000 * zoom
The 400 is based on the canvas container size?
And the 1000? Is based on Rect dimension (990) + 10px or margin?
On the example, it works fine, where everything is a square, but on the app that I'm building the canvas container has a rectangle format 2970x2100 and some flickers when the zoom out, reaches the limits
You can check what did, here https://codepen.io/victorneves/full/oNzOPdj
Any help would be appreciated
Thanks
Beta Was this translation helpful? Give feedback.
All reactions