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

onDrawStart and onDrawEnd not working for RModify interaction #220

Closed
stefgootzen opened this issue Feb 27, 2024 · 4 comments · Fixed by #221
Closed

onDrawStart and onDrawEnd not working for RModify interaction #220

stefgootzen opened this issue Feb 27, 2024 · 4 comments · Fixed by #221

Comments

@stefgootzen
Copy link

stefgootzen commented Feb 27, 2024

The following event handlers do not execute when changing the feature geometry. I'm on RLayers currently on 2.2.0.

 <RInteraction.RModify
    onDrawStart={() => {
      console.log("start");
    }}
    onDrawEnd={() => {
      console.log("end");
    }}
  />
@mmomtchev
Copy link
Owner

It works for me, there must be some other conditions. Do this in the Draw.tsx example:

<RInteraction.RDraw
    type={'Circle'}
    onDrawStart={() => {
        console.log('start');
    }}
    condition={altKeyOnly}
    freehandCondition={never}
/>

You will see the message when you draw a circle.

@stefgootzen
Copy link
Author

There you put the onDrawStart on the Circle, however, the RModify interaction also have those event handlers, those don't seem to work.

I noticed that in the Openlayers Spec they use:

modifyend (ModifyEvent) - Triggered upon feature modification end
modifystart (ModifyEvent) - Triggered upon feature modification start

@mmomtchev
Copy link
Owner

Ah yes, indeed. You can simply pass onModifyStart instead of onDrawStart and it will work - it is only the TypeScript type that is wrong.

@stefgootzen
Copy link
Author

Ah yes, that's it. Thanks for the quick replies!

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 a pull request may close this issue.

2 participants