diegoazh / gmap-vue

A wrapper component for consuming Google Maps API built on top of Vue. Fork of the popular vue-google-maps plugin.
https://diegoazh.github.io/gmap-vue/
173 stars 51 forks source link

Bug: Shapes have editable prop but do not respond to edits #266

Closed davydnorris closed 2 years ago

davydnorris commented 2 years ago

Describe the bug

The current implementation of the Google Maps API Shapes have props to set draggable and editable, however their implementation ignores any changes to the shapes if these are set to true.

The only Shape that is properly reactive is the Marker, which responds to dragend and emits an update event with the new position. However Marker also exposes drag events, and I'm not sure it then emits dragend after the update - this needs to be checked

To reproduce

Steps to reproduce the behavior:

  1. Create a project that shows a map with different shapes on it
  2. Set the shapes draggable to true
  3. Drag the shape
  4. The shape will move on the map but no events are fired and any position based prop is unchanged
  5. Set the shapes editable to true
  6. Edit the shape in some way
  7. The shape will change but no events are fired and any position or size based prop is unchanged

Expected behavior

Either appropriate events are emitted for all shape changes, or v-model behavior is implemented that allows full reactivity

Current behavior

Nothing - the changes to shapes are not communicated back in any way and you cannot get to the details. The drag events are bound but the details passed back are not enough to properly recalculate the Shape's position, especially if geodesic is also set.

Screenshots

N/A

Desktop (please complete the following information)

Smartphone (please complete the following information)

Additional context

The events that need to be captured during editing are in the following documentation https://developers.google.com/maps/documentation/javascript/shapes#editable_events If draggable is set to true then we would want to capture dragend and emit the appropriate event

Versions

Package manager

Plugin version

davydnorris commented 2 years ago

Actually upon a closer look they actually do - the bug is actually in the Marker position update, which has been implemented differently to the others. Will raise a separate bug