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

improve map component defaultInteractionsOptions prop #215

Merged
merged 2 commits into from
Aug 26, 2019

Conversation

jemasfox
Copy link
Contributor

Added a defaultInteractionsOptions prop to the map component to be able to pass options into the interactions defaults function when map.vue calls it.
I mainly needed a way to add the onFocusOnly boolean in so the DragPan and MouseWheelZoom interactions only activate on map focus. I tried many other ways to accomplish this without having to create a set of interactions of my own. I even tried setting the interactions on mounted and created using the defaults function the same way the map component does, but for some reason the map property didn't get set for the interactions and openlayers was logging errors to the console any time I used DragPan.

@coveralls
Copy link

coveralls commented Aug 20, 2019

Coverage Status

Coverage increased (+0.03%) to 22.287% when pulling db1511f on jemasfox:master into d3c740e on ghettovoice:master.

@ghettovoice ghettovoice merged commit db1511f into ghettovoice:master Aug 26, 2019
@ghettovoice
Copy link
Owner

Thanks for contribution!

ghettovoice added a commit that referenced this pull request 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 pull request 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
@majdal
Copy link

majdal commented Jun 22, 2021

Hello hello - I'm looking at the Master branch, and it looks like the defaultInteractionsOptions prop is no longer there.

Is there a recommended way set onFocusOnly on an interaction?

@jemasfox
Copy link
Contributor Author

Hello hello - I'm looking at the Master branch, and it looks like the defaultInteractionsOptions prop is no longer there.

Is there a recommended way set onFocusOnly on an interaction?

I believe the prop was changed to defaultInteractions. I think the way that was working for me was to set the prop on the vl-map.
Something like :default-interactions="{ constrainResolution: true, onFocusOnly: true }".
I think I also put a click event handler on it's parent div which calls a function that basically just has this
if (document.activeElement.id !== 'vl-map-map-component') document.getElementById('vl-map-map-component').focus();
Hope that helps you out.

@ghettovoice
Copy link
Owner

Hi there!
Yes, this prop was renamed some time ago. I'm not sure when..
Anyway it is named as defaultInteractions in v0.12 and v0.11

@majdal
Copy link

majdal commented Jun 22, 2021

Beautiful :) Works as expected.

I'm guessing that this would be very useful to other developers. Maybe we should add it to the docs at vl-map#properties?

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.

4 participants