Closed patdunlavey closed 4 months ago
I tried to find information about a minimum height for leaflet maps, and could not find any. If we can find a reference that defines one, we could use that. However, I think an absolute minimum height probably can't be presumed since, arguably, it would be subject to selected options for map control widgets and whatnot. I propose that we simply change the value of the minimum height, currently set at 480 pixels, to something like 10, only to ensure that a site admin can't make their map literally disappear at zero height.
As for the scroll-wheel zoom, I researched this a bit. Does this sound right to you @DiegoPino ?
Here, add a checkbox to "Disable mouse wheel zoom":
'disable_mouse_zoom' => [
'#type' => 'checkbox',
'#title' => $this->t('Disable mouse wheel zoom'),
'#default_value' => $this->getSetting('disable_mouse_zoom'),
],
and here, get this setting into the leaflet map initialization:
var $disable_mouse_zoom = false;
if (drupalSettings.format_strawberryfield_views.leaflet[element_id]['disable_mouse_zoom']) {
$disable_mouse_zoom = drupalSettings.format_strawberryfield_views.leaflet[element_id]['disable_mouse_zoom'];
}
// initialize the map
var map = L.map(element_id, {
zoom: 2,
maxZoom: $maxzoom,
scrollWheelZoom: $disable_mouse_zoom ? false : true
}
Any thoughts, @DiegoPino ?
Hi, could you measure in pixels the interface? Plus and minus icons? That should be the minimum but honestly if 12 pixels is what you all need that also ok, as long as that is not the default. For the pull, code looks good, don’t forget to add the config option + defaults to the schema yaml for the zoom wheel and a js default in case an old archipelago without re-saving the config calls the new js variables
On Tue, Feb 13, 2024 at 1:36 PM Pat Dunlavey @.***> wrote:
I tried to find information about a minimum height for leaflet maps, and could not find any. If we can find a reference that defines one, we could use that. However, I think an absolute minimum height probably can't be presumed since, arguably, it would be subject to selected options for map control widgets and whatnot. I propose that we simply change the value of the minimum height, currently set at 480 pixels, to something like 10, only to ensure that a site admin can't make their map literally disappear at zero height.
As for the scroll-wheel zoom, I researched this a bit. Does this sound right to you @DiegoPino https://github.com/DiegoPino ?
Here https://github.com/esmero/format_strawberryfield/blob/1.3.0/src/Plugin/Field/FieldFormatter/StrawberryMapFormatter.php#L504C1-L513C1, add a checkbox to "Disable mouse wheel zoom":
'disable_mouse_zoom' => [ '#type' => 'checkbox', '#title' => $this->t('Disable mouse wheel zoom'), '#default_value' => $this->getSetting('disable_mouse_zoom'), ],
and here https://github.com/esmero/format_strawberryfield/blob/1.3.0/modules/format_strawberryfield_views/js/leaflet_strawberry_views.js#L55, get this setting into the leaflet map initialization:
var $disable_mouse_zoom = false; if (drupalSettings.format_strawberryfield_views.leaflet[element_id]['disable_mouse_zoom']) { $disable_mouse_zoom = drupalSettings.format_strawberryfield_views.leaflet[element_id]['disable_mouse_zoom']; }
// initialize the map var map = L.map(element_id, { zoom: 2, maxZoom: $maxzoom, scrollWheelZoom: $disable_mouse_zoom ? false : true }
Any thoughts, @DiegoPino ?
— Reply to this email directly, view it on GitHub https://github.com/esmero/format_strawberryfield/issues/414#issuecomment-1941967361, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABU7ZZZPH53RRPYL4ZKTNSTYTOJAPAVCNFSM6AAAAABDGZPEVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBRHE3DOMZWGE . You are receiving this because you were mentioned.Message ID: @.***>
Thank YOU!
StrawberryMapFormatter
settings form to allow the site builder to disable mouse scroll-wheel zoom.