Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Control.Geocoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
},

geocode: function(query, cb, context) {
L.Control.Geocoder.jsonp(this.options.serviceUrl + 'search/', L.extend({
L.Control.Geocoder.jsonp(this.options.serviceUrl + 'search', L.extend({
q: query,
limit: 5,
format: 'json',
Expand All @@ -367,7 +367,7 @@
},

reverse: function(location, scale, cb, context) {
L.Control.Geocoder.jsonp(this.options.serviceUrl + 'reverse/', L.extend({
L.Control.Geocoder.jsonp(this.options.serviceUrl + 'reverse', L.extend({
lat: location.lat,
lon: location.lng,
zoom: Math.round(Math.log(scale / 256) / Math.log(2)),
Expand Down
5 changes: 5 additions & 0 deletions InputfieldLeafletMapMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ var InputfieldLeafletMapMarker = {
map.invalidateSize();
}, 200);
});

if ($('div.InputfieldLeafletMapMarkerMap').hasClass('scrollwheel-disabled')){
map.scrollWheelZoom.disable()
}

}
};

Expand Down
15 changes: 14 additions & 1 deletion InputfieldLeafletMapMarker.module
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class InputfieldLeafletMapMarker extends Inputfield {
require_once(dirname(__FILE__) . '/LeafletMapMarker.php');
$this->set('defaultAddr', self::defaultAddr);
$this->set('defaultZoom', 12);
$this->set('scrollWheelZoom', false);
$this->set('defaultLat', '');
$this->set('defaultLng', '');
$this->set('height', 500);
Expand Down Expand Up @@ -108,6 +109,7 @@ class InputfieldLeafletMapMarker extends Inputfield {
$mapType = $this->defaultType;
$provider = $this->defaultProvider;
$height = $this->height ? (int) $this->height : 300;
$scrollWheelZoom = $this->scrollWheelZoom;

$labels = array(
'addr' => $this->_('Address'),
Expand Down Expand Up @@ -154,7 +156,9 @@ class InputfieldLeafletMapMarker extends Inputfield {

_OUT;

$out .= "<div class='InputfieldLeafletMapMarkerMap' " .
($this->scrollWheelZoom == true) ? $class = ' scrollwheel-disabled' : $class = '';

$out .= "<div class='InputfieldLeafletMapMarkerMap{$class}' " .
"id='_{$id}_map' " .
"style='height: {$height}px' " .
"data-lat='$marker->lat' " .
Expand Down Expand Up @@ -293,6 +297,15 @@ _OUT;
$field->attr('type', 'number');
$inputfields->add($field);

$field = $this->modules->get('InputfieldCheckbox');
$field->attr('name', 'scrollWheelZoom');
$field->label = $this->_('Scrollwheel Zoom Disable');
$field->label2 = $this->_('Check this to lock Scrollwheel Zoom ad prevent unwanted zoom in admin page edit');
$field->description = $this->_('Lock zoom by mouse wheel scroll'); // Zoom level description
$field->attr('value', $this->scrollWheelZoom ? $this->scrollWheelZoom : 0 );
$field->attr('checked', $this->scrollWheelZoom === 1 ? 'checked' : '' );
$inputfields->add($field);

$field = $this->modules->get('InputfieldSelect');
$field->attr('name', 'defaultProvider');
$field->label = $this->_('Default Map Tile Provider');
Expand Down