Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Using Ctrl+Scroll to zoom like in google maps #52

Open
biladina opened this issue Jan 18, 2021 · 0 comments
Open

Using Ctrl+Scroll to zoom like in google maps #52

biladina opened this issue Jan 18, 2021 · 0 comments

Comments

@biladina
Copy link

this is not an issue, maybe info to who need it..
if you need to use scroll gesture handling like ctrl+scroll to zoom, you can use this leaflet addon

  • download the addon release, copy 'dist' folder to your path in yii2
  • add this code to your form or view.. (in my case, '@web/vendor/leaflet_gesture' is my folder for addon)
$this->registerCssFile('@web/vendor/leaflet_gesture/leaflet-gesture-handling.min.css');
$this->registerJsFile('@web/vendor/leaflet_gesture/leaflet-gesture-handling.min.js', ['depends' => [\dosamigos\leaflet\LeafLetAsset::className()]]);
  • add this code $leafLet->appendJs('map.gestureHandling.enable();');, the end result maybe like this :
$leafLet = new LeafLet([
    'name' => 'map',
    'tileLayer' => $tileLayer,
    'center' => $center,
    'zoom' => 12,
]);
$leafLet->appendJs('map.gestureHandling.enable();');
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant