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 setActive transforminteraction by default #34

Closed
AntoniBCN opened this issue Apr 3, 2017 · 2 comments
Closed

How to setActive transforminteraction by default #34

AntoniBCN opened this issue Apr 3, 2017 · 2 comments

Comments

@AntoniBCN
Copy link

Hello,

Hi I would have enabled (turned on) the transforminteraction control by default and thus, user does not need to click over the feature to see transformation icons.

Is this possible?

the code bellow does not work:

	var interaction = new ol.interaction.Transform (
		{	
			translateFeature: false,
			scale: true,
			rotate: false,
			keepAspectRatio: undefined,
			translate: true,
			stretch: true,
			source: source,
		});
	interaction.setActive(true);
	map.addInteraction(interaction);

Thanks in advance.

@Viglino
Copy link
Owner

Viglino commented Apr 3, 2017

Hello,

The select method of the transform interaction will do that.
You just have to pass the feature you want to transform:

var f = source.getFeatures()[0];
interaction.select(f);

@+

@AntoniBCN
Copy link
Author

Great !! Thanks a lot.

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