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
EasyPZ enabling constructor not working #8
Comments
Hi Monfeaz, To me, it looks like it's working as intended, although the intended usage might be a bit awkward for your use case and I'm open to feedback. When using the JS-based version of EasyPZ, the default behavior is to detect pan and zoom gestures and call the passed callback functions, but nothing else. It's assuming you want to take care of applying the transformation to the SVG or canvas yourself, unless you pass the last parameter, called "applyTransformTo". You don't need to specify all the enabled pan and zoom modes to use the default ones, so you could call easypz like this: The reason this works this way is that when I set up the default behaviors, I assumed that people using EasyPZ with JS want to use custom behavior and probably don't want EasyPZ to automatically apply the transformation, whereas the HTML version of EasyPZ is for easier use and just assumes you don't want to customize much. What is the reason for you wanting to use the JS version of EasyPZ if you're trying to use the default transformation? Thanks for your feedback, I appreciate it! |
Hello Michail, I wanted to use the JS version in order to have a reference to the EasyPZ object in case I might need it later, and I didn't know how to get it from the HTML declaration. Thank you for supporting this project still. Let me know if you have something set up for donations. |
Hey Monfeaz! No donations needed, thank you! I'm happy if people are using EasyPZ or even contribute to it. |
Hello Michail,
The normal constructor via javascript is not working for me, like below:
var easypz = new EasyPZ( document.querySelectorAll('svg')[0], function() {} );
But it works if I pass all parameters:
var easypz = new EasyPZ( document.querySelectorAll('svg')[0], function() {}, {}, ["SIMPLE_PAN", "HOLD_ZOOM_IN", "CLICK_HOLD_ZOOM_OUT", "WHEEL_ZOOM_EASE", "PINCH_ZOOM", "DBLCLICK_ZOOM_IN", "DBLRIGHTCLICK_ZOOM_OUT"], {}, function() {}, function() {}, function() {}, "svg > *" );
I'm not sure if it's a mistake on my part or some browser update broke it. The SVG looks like this:
<svg width="100%" height="200" style="background-color: antiquewhite;"> <rect id='rect' x='0' y='0' width='100%' height='700'/> <rect x='10' y='20' width='100' height='80'/> </svg>
There's nothing else in it.
Thanks for this great library.
The text was updated successfully, but these errors were encountered: