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

how to keep transform always active #38

Closed
didlich opened this issue May 9, 2017 · 2 comments
Closed

how to keep transform always active #38

didlich opened this issue May 9, 2017 · 2 comments

Comments

@didlich
Copy link

didlich commented May 9, 2017

Hi, I found an issue #34 which tells how to activate the transform by default, but how you would keep it active all the time?
If I click besides the feature it looses the transforminteraction. I would like too keep it all the time active. Is there an option I can set to achieve that?

thx

@Viglino
Copy link
Owner

Viglino commented May 10, 2017

Hi,
Actually, the transform interaction contains a select interaction that means clicking outside the feature will deselect it and thus lose the transformation.
You have to listen to the "select" event to prevent from deselection:

interaction.on("select", function(e)
{	if (!e.feature) interaction.select(theFeature);
});

If you want to control the set of features you want to be selectable on click you also have to define the 'features' parameters on creation. To avoid selection, just define an empty collection:

var interaction = new ol.interaction.Transform (
{	features: new ol.Collection()
});

@didlich
Copy link
Author

didlich commented May 10, 2017

exactly what I want, thanks very much

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

No branches or pull requests

2 participants