ghettovoice/ol-rotate-feature

Anchor does not reset after feature is changed

StavroMueller opened this issue · 2 comments

I've noticed that the interaction does not re-calculate the anchor property on a feature if it is already present when creating the new interaction. This was a problem because I am working on an app that involves manipulating a feature with different interactions, and the anchor wouldn't update if a feature had been moved. This led me to have to write feature.U.anchor = [] after the other events were finished to correctly update the anchor. If you like, I can create a PR to fix this once I look through this code!

Hi!
The idea was that: anchor and angle doesn't reset in order to be able to restore the last state of rotation.
I agree that would not prevent the ability to reset these values.
I think, there should be an option that allows you to define whether or not to reset anchor and angle properties, that property should be tested in method RotateFeatureInteraction.prototype.reset_. That method called when interaction deattached from the map.
I can't fix it until Monday. So, you are welcome to write pull request.

I completely revised my opinion about saving last state of the rotation in the features. I think it is outside the responsibility of this package.
Now interaction saves only current angle and anchor position in its own properties, this properties are available by calling new getter methods (see release note for the new version).
I hope this release fixes your issue and close this ticket.