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

Added an event to get the feature during a Draw Interaction #1957

Closed
wants to merge 2 commits into from

Conversation

jahuth
Copy link

@jahuth jahuth commented Apr 7, 2014

The Draw Interaction only presents the drawn feature after the interaction was finished. If one wants to react to the shape of the figure during drawing this is so fat impossible.
With the added event, users can react to every change of the feature.

To be able to use the feature not only after, but during drawing, an event is need for pointer movement and subsequent changes to the preview.
@elemoine
Copy link
Member

elemoine commented Apr 7, 2014

Instead of adding an event to the Draw interaction can't we rely on "change" events from the feature?

var handleFeatureChange = function(e) {
   var feature = e.target;
   // do something with feature
};
draw.on('drawstart', function(e) {
  e.feature.on('change', handleFeatureChange);
});
draw.on('drawend', function(e) {
  e.feature.un('change', handleFeatureChange);
});

@ahocevar
Copy link
Member

ahocevar commented Apr 7, 2014

+1 on @elemoine's suggestion.

@jahuth
Copy link
Author

jahuth commented Apr 7, 2014

Yes, that is correct! Thank you, @elemoine's suggestion works as intended.

@jahuth jahuth closed this Apr 7, 2014
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

Successfully merging this pull request may close these issues.

None yet

3 participants