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

EditBar improvement #599

Closed
labronico0586 opened this issue May 3, 2021 · 3 comments
Closed

EditBar improvement #599

labronico0586 opened this issue May 3, 2021 · 3 comments

Comments

@labronico0586
Copy link

It is meaningful to use CopyPaste interaction with the Transform control (and interaction) as explained in http://viglino.github.io/ol-ext/examples/bar/map.control.editbar.html example.

So it could be useful to add Cut, Copy and Paste buttons to a Bar (subbar) activated when the Transform control is activated (as it happens in Select control in the EditBar).

The request is to add a way to do that.

The proposal is:

  1. add name (optional using options parameter) for all controls used in EditBar, so it could possible to get them later using getControlByName function;
  2. add setSubBar function to Toggle control, in order to add (or remove) a bar in control (now it is possible only in constructor)
Viglino added a commit that referenced this issue May 3, 2021
@Viglino
Copy link
Owner

Viglino commented May 3, 2021

💡 Great idea... this was missing! 👍
Added in the last commit 🚀

var mySubBar = new ol.control.Bar()
// Add a sub-bar to the Transform button
editBar.getControlsByName('Transform')[0].setSubBar(mySubBar);

The name is the one of the interaction:

var ctrl = editBar.getControlsByName('Transform')[0];
var inter = edit.getInteraction('Transform');
// For draw interaction : DrawPoint, DrawLine, DrawPolygon, DrawRegular
var ctrl = editBar.getControlsByName('DrawPolygon')[0];
var inter = edit.getInteraction('DrawPolygon');

@labronico0586
Copy link
Author

That's a great notice! Thanks.
But why you called the new method to add a bar SetSubBar instead of setSubBar. It breaks your naming rules...

@Viglino
Copy link
Owner

Viglino commented May 4, 2021

It's a typo 😞
Fixed in the last commit...

@Viglino Viglino closed this as completed Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants