-
Notifications
You must be signed in to change notification settings - Fork 9
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
Added more configurable options #1
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 3 3
Lines 45 62 +17
=====================================
+ Hits 45 62 +17
Continue to review full report at Codecov.
|
Hi Ben, Regards |
Additions:
I also updated it to work with this pull request on free-transform which fixed the behavior of Aspect ratio can also be a float specifying a fixed aspect ratio to snap the transformation to. This isn't necessary most of the time, but I'm planning on having a toggle for that in an app I'm working on so I figured I'd include it. I updated the example to reflect some of the added features. |
Yeah no problem! This is a really nice repo. It solves a problem I've been having and cleans up my code significantly. |
Now you can enable/disable handles using props.
rotateEnabled={false}
lets you turn off rotation.translateEnabled={false}
lets you turn off dragging.scaleEnabled={false}
lets you turn off scaling. This definitely has a problematic name similarity todisableScale
. I'm not quite sure how best to resolve that.open={false}
allows you to disable free transform all together.scaleHandles={['tl', 'tr', ...]}
lets you specify exactly which handles you want to use. I added some shortcuts for conveniencecorners
andsides
as those are probably the most frequently used.I also attempted to add props for
scaleFromCenter
andaspectRatio
so they could be enabled all the time, butfree-transform
didn't seem to be listening to those settings. It seems that when you pass them into free-transform::scale, their values are being overwritten. The problem is being caused on line 77 of free-transform/lib/scale.js and I'm not really sure why that line is being used. But I can't find the repo to fork it or anything so they just won't do anything.