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

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

@biladina

Description

@biladina

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();');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions