-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Ability to customize controls [$150] #1947
Comments
Yes, it would be nice to give possibility to hook into process of rendering controls as well as manipulating controls. For example, right now controls are rendered with the solid color but I would like to apply some filter like in Photoshop, where border on black background is white and on the white background border is black (difference filter). Thanks to that, borders are always visible, no matter on what background it's displayed. |
Would be a generic control with -position on the object ( corner, or position on side ) would be ok for @kangax and the backer? |
Sounds good! Would be nice to be able to position the generic control relative to top-right, for example (or is that what "position on side" meant?) |
Removing controls is already possible. Adding new ones with custom icons/position — that would definitely be a new feature. I'm sort of open to it, but maybe later. We already have lots of features and I'm trying to avoid bloating library too much. |
So i would ask the backer what are the minimum requirement for him, what satisfy his request and if a pull in the official library is a requirement. That doesn't mean i will necessary do that, but because i'm interested ( even if i have no time now ) both in the result and the money, i'm investigating for now. |
A pull to the official library is a requirement. For the current project I need to add at least 4 buttons. I'd like to be able to position these relative to a corner (top right, for example). I should be able to define how these are drawn and action upon click. (action upon moving isn't required, but would be nice) |
I found this solution in fabric google group could it be possible to merge this solution to pull official distro, it would be nice to have this kind of feature build in |
We have to found a solution that works in any case, that does not pollute the code, and that we have the chance to support with future changes. For example, if it will ever be, this customization has to work per object, with functions toObject and restoreFromObject to work as well. Imagine a text class where you want the corner to resize the dimension and not the scale (like text box ) and for a normal object you want to keep the scale behahvior. User has to have the chance to define is own function for that control. |
Hi @asturur |
unfortunately lately i'm very busy with life changes and i did not develop too much in my free time. |
I have had a few similiar requirements in a project i have been working on the last weeks. This it what came out of it: I added a few features requested in this thread but the customisation has it's limit when it comes to being object specific for everything. |
I was checking the code and started to close this issue. Would it be worth to add: That would mean setup canvas valuse as current object valuse, and leave object values to null, so that a check like:
may work. |
I think it would make sense since you only want to override it for very special objects. Otherwise a canvas setting for all objects would be more than enough. |
If you ask me, this sort of customization should be easy to add, and not something as part of the core. These things are very easily over-ridden in _drawControls. |
icons yes. actions and cursor not really easy. |
snap to grid and rotation angles are in scope of this? |
No. This will include chance to add custom icons and a chance to add custom functions to corners. You will write your own function to add to controls. So yes you can do it, No it will not come from us. |
Perfect! 'can do it' is enough for us. We already did most of the layer tooling out of the corner controls anyway, makes more sense than on the shape itself for those, but for rotation we couldn't find the hooks. |
i can give you the code out so far, i wanted to postpone this issue because i have bigger to care of now. |
Hi @asturur, Can you provide a status update on this issue? Best regards, |
Good staff! I like this feature, because I need to put the control below the control. Any progress of this feature? |
I'm interested as well. |
What I'm using at the moment is this: but the issue is that the controls are stored on the prototype of the canvas and you have to overwrite them each time. I ran into some problems, I expect more in the future. Is there a chance to support a new way in the near future to make this easier? Best regards, |
For now not. Those are my personal prioirities. If i should support this kind of feature that means i should provide: maybe other things. Is not in my list of priorities, despite the 150$ bounty. |
Hey there, i am the author of the extension mentioned above. Frankly i think it might be a shitton of work to get this API nice and implemented in fabric. I'd be willing to help whenever you want to give it a go though. @p3ndo If you encounter any problems, feel free to open an issue in the meantime :) Regards, |
Hi @MDSLKTR, Great work with the extension and we really appreciate it, don't take it the wrong way. I will surely open one if I can't figure out some things with the extension. Best regards, |
Hey p3ndu, thank you and no worries mate, it's all good :). Just wanted to chip in and underline that i eventually want to get this into the core as keeping up with new fabric versions is sometimes time consuming especially on major version bumps. Regards, |
Hello, |
Hello, vijaygurjar. |
I feel like i finally close this with the current state of fabric 4.beta |
@asturur I'm trying to overwrite the render functionality for custom icons, but it looks like the icons aren't rendered on TextBox elements, but they're however rendered on images, or shapes. See: jsFiddle Custom images also aren't loaded until: a user has clicked on atleast 2 elements, or clicked on 1 element & moved it, or re-scaled the element. |
Does anyone have an update on this issue? |
did not look at your fiddle yet, but probably i can today |
that'd be great, thank you |
Ok i had already checked this fiddle, but for some reason i couldn't answer. http://fabricjs.com/controls-api As written there, Texbox does not share the same control set with Object ( because has 2 different controls on ml, mr ). Simply you have to change the mtr also on fabric.Textbox.prototype.controls |
aha that does make sense, I've changed it, and it works perfectly fine now. |
Would love to be able to add, remove and modify the controls in an easy way.
For the current project I need to add "delete", "move down", "move up" (layer-wise) and "rotate by degrees" to the controls.
There is a $150 open bounty on this issue. Add to the bounty at Bountysource.
The text was updated successfully, but these errors were encountered: