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 use vl-interaction-modify with reactive features? #132

Closed
fnoop opened this issue Feb 1, 2019 · 3 comments
Closed

How to use vl-interaction-modify with reactive features? #132

fnoop opened this issue Feb 1, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@fnoop
Copy link

fnoop commented Feb 1, 2019

If I create a source vector layer with features created in a template, like:

vl-layer-vector
        vl-source-vector(ref="waypointLayer" ident="waypoint-draw-target")
          vl-feature(v-if="missionActive[activeApi]" v-for="(waypoint, index) in missionActive[activeApi].mission" :id="'w_' + index" :key="'w_' + index")

And then make the features draggable like:
vl-interaction-modify(source="waypoint-draw-target")

Then when you drag a feature, it snaps back to it's original position shortly, presumably because the source value to the feature is reactive?

So how to make existing features modifiable? If I create an empty source layer using an empty features container:

      vl-layer-vector
        vl-source-vector(ref="waypointLayer" ident="waypoint-draw-target" :features.sync="waypointFeatures")

Then how to populate the features array with feature components programatically?

@fnoop
Copy link
Author

fnoop commented Feb 1, 2019

This works in a watcher, but it's a bit crude:

        let newFeatures = mission
          .filter(waypoint => waypoint.latitude && waypoint.longitude)
          .map(waypoint => ({
            geometry: {
              type: 'Point',
              coordinates: [waypoint.longitude, waypoint.latitude]
            },
            type: 'Feature'
          }))
        this.$refs.waypointLayer.addFeatures(newFeatures)

@ghettovoice
Copy link
Owner

There is known bug #121, that can be related with your problem.
I plan to release next patch in the near future that should resolve reactive problems with features prop
in all components

@ghettovoice ghettovoice self-assigned this Feb 2, 2019
@ghettovoice ghettovoice added the bug label Feb 2, 2019
@stale
Copy link

stale bot commented May 5, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 5, 2019
@ghettovoice ghettovoice added pinned and removed stale labels May 5, 2019
@ghettovoice ghettovoice added this to the v0.11.5 milestone Jun 17, 2019
ghettovoice added a commit that referenced this issue Sep 27, 2019
Let Vue update reactive properties before transmitting ol events.
So at the event time all computed properties (like source features)
should be already updated.

#132 #224 #225 #226
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #132 #224 #225 #226, #230
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #173, #174, #201, #135, #216, #132 #224 #225 #226, #230
- merged of pull requests #160, #175, #180, #185, #188, #191, #206, #208,
  #212, #213, #215, #221, #227, #231
  Thanks to @baspeeters, @sjmallon, @janlazo, @categulario,
  @skymaze, @jemasfox, @owen-thurston, @agmt5989, @RemiDesgrange
- improved property watchers
- optional debug messages
- fixed broken UMD version
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
- updated documentation and README
ghettovoice added a commit that referenced this issue Oct 3, 2019
- resolved #173, #174, #201, #135, #216, #132 #224 #225 #226, #230
- merged of pull requests #160, #175, #180, #185, #188, #191, #206, #208,
  #212, #213, #215, #221, #227, #231
  Thanks to @baspeeters, @sjmallon, @janlazo, @categulario,
  @skymaze, @jemasfox, @owen-thurston, @agmt5989, @RemiDesgrange
- improved property watchers
- optional debug messages
- fixed broken UMD version
- simplified initial interaction/controls setup #95
- added `id` property for all ol components for easy identification
- mixins, ol-ext and rx-ext now are build to single file package,
  imports from those packages are not changed
- UMD version (dev/demo version) now includes all used stuff from `ol`
  package
- updated documentation and README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants