Changeset 2499825
- Timestamp:
- 03/20/2021 12:10:51 AM (5 years ago)
- Location:
- osm-map-elementor
- Files:
-
- 4 deleted
- 4 edited
-
tags/1.0.0 (deleted)
-
tags/1.0.3 (deleted)
-
tags/1.0.4 (deleted)
-
tags/1.0.5 (deleted)
-
trunk/constants.php (modified) (1 diff)
-
trunk/osm-map-elementor.php (modified) (1 diff)
-
trunk/osm-map.php (modified) (12 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
osm-map-elementor/trunk/constants.php
r2482067 r2499825 1 1 <?php 2 2 define('OSM_MAP_SLUG', 'osm-map-elementor'); 3 define('OSM_MAP_VERSION', '1.0.6'); 3 define('OSM_PLUGIN_FOLDER', basename(__DIR__)); 4 define('OSM_MAP_VERSION', '1.0.7'); -
osm-map-elementor/trunk/osm-map-elementor.php
r2482067 r2499825 5 5 * Author: ACT Innovate 6 6 * Author URI: https://github.com/flopperj/elementor-osm-map 7 * Version: 1.0. 67 * Version: 1.0.7 8 8 */ 9 9 -
osm-map-elementor/trunk/osm-map.php
r2482074 r2499825 11 11 use Elementor\Core\Kits\Documents\Tabs\Global_Colors; 12 12 use Elementor\Core\Kits\Documents\Tabs\Global_Typography; 13 use Elementor\Core\Responsive\Responsive; 13 14 14 15 /** … … 256 257 ); 257 258 258 $this->add_ control(259 $this->add_responsive_control( 259 260 'zoom', 260 261 [ 261 262 'label' => __('Zoom Level', self::$slug), 262 263 'type' => \Elementor\Controls_Manager::SLIDER, 263 'default' => [264 'size' => 10,265 ],266 264 'range' => [ 267 265 'px' => [ … … 269 267 'max' => 20, 270 268 ], 269 ], 270 'devices' => ['desktop', 'tablet', 'mobile'], 271 'desktop_default' => [ 272 'size' => 10, 273 'unit' => 'px', 274 ], 275 'tablet_default' => [ 276 'size' => 10, 277 'unit' => 'px', 278 ], 279 'mobile_default' => [ 280 'size' => 10, 281 'unit' => 'px', 271 282 ], 272 283 'separator' => 'before', … … 1346 1357 $settings = $this->get_settings_for_display(); 1347 1358 $markers = $this->get_settings_for_display('marker_list'); 1359 $settings['breakpoints'] = Responsive::get_breakpoints(); 1348 1360 1349 1361 if (0 === absint($settings['zoom']['size'])) { … … 1379 1391 echo '<div id="osm-map-' . $this->get_id() . '" 1380 1392 class="osm-map-container" 1381 data-center="' . implode(',', $center_coords) . '" 1382 data-zoom="' . $settings['zoom']['size'] . '"></div>'; 1393 data-center="' . implode(',', $center_coords) . '"></div>'; 1383 1394 1384 1395 ?> … … 1390 1401 jQuery(window).ready(function () { 1391 1402 "use strict"; 1403 const displaySettings = <?php echo json_encode($settings); ?>; 1392 1404 const mapId = '<?php echo 'osm-map-' . $this->get_id(); ?>'; 1393 1405 const mapContainer = jQuery('#' + mapId); 1394 1406 const center = mapContainer.data('center'); 1395 const zoom = mapContainer.data('zoom'); 1407 const hasDesktopZoomLevel = displaySettings && displaySettings.hasOwnProperty('zoom') && displaySettings.zoom && displaySettings.zoom.hasOwnProperty('size'); 1408 const hasTabletZoomLevel = displaySettings && displaySettings.hasOwnProperty('zoom_tablet') && displaySettings.zoom_tablet && displaySettings.zoom_tablet.hasOwnProperty('size'); 1409 const hasMobileZoomLevel = displaySettings && displaySettings.hasOwnProperty('zoom_mobile') && displaySettings.zoom_mobile && displaySettings.zoom_mobile.hasOwnProperty('size'); 1410 let zoomLevel = hasDesktopZoomLevel ? displaySettings.zoom.size : 10; 1411 1412 // look at break points for different screen sizes 1413 const viewPortWidth = jQuery('body').width(); 1414 const isTabletView = displaySettings && 1415 displaySettings.hasOwnProperty('breakpoints') && displaySettings.breakpoints && 1416 displaySettings.breakpoints.hasOwnProperty('sm') && 1417 displaySettings.breakpoints.hasOwnProperty('md') && 1418 viewPortWidth > displaySettings.breakpoints.sm && 1419 viewPortWidth <= displaySettings.breakpoints.md; 1420 const isMobileView = displaySettings && 1421 displaySettings.hasOwnProperty('breakpoints') && displaySettings.breakpoints && 1422 displaySettings.breakpoints.hasOwnProperty('sm') && 1423 viewPortWidth <= displaySettings.breakpoints.sm; 1424 1425 // check for tablet and mobile screen sizes 1426 if (hasTabletZoomLevel && isTabletView) { 1427 zoomLevel = displaySettings.zoom_tablet.size; 1428 } else if (hasMobileZoomLevel && isMobileView) { 1429 zoomLevel = displaySettings.zoom_mobile.size; 1430 } 1396 1431 1397 1432 // avoid recreating the html element … … 1408 1443 if (center) { 1409 1444 let centerCoords = center.split(','); 1410 map.setView(centerCoords, zoom );1445 map.setView(centerCoords, zoomLevel); 1411 1446 } 1412 1447 … … 1537 1572 const buildMarkers = function (markers) { 1538 1573 1574 let _markers = []; 1539 1575 jQuery.each(markers, function () { 1540 1576 const marker = L.marker([this.lat, this.lng], markerOptions); 1577 _markers.push(marker); 1541 1578 1542 1579 // add marker to map … … 1640 1677 1641 1678 // set center coordinates 1642 map.setView([lat, lng], zoom );1679 map.setView([lat, lng], zoomLevel); 1643 1680 1644 1681 // build our markers … … 1678 1715 1679 1716 $styles = [ 1680 'leaflet' => plugins_url('/ osm-map-elementor/assets/leaflet/leaflet.css'),1681 'mapbox-gl' => plugins_url('/ osm-map-elementor/assets/css/mapbox-gl.css'),1682 'leaflet-fa-markers' => plugins_url('/ osm-map-elementor/assets/leaflet-fa-markers/L.Icon.FontAwesome.css'),1683 'osm-map-elementor' => plugins_url('/ osm-map-elementor/assets/css/osm-map-elementor.css')1717 'leaflet' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/leaflet/leaflet.css'), 1718 'mapbox-gl' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/css/mapbox-gl.css'), 1719 'leaflet-fa-markers' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/leaflet-fa-markers/L.Icon.FontAwesome.css'), 1720 'osm-map-elementor' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/css/osm-map-elementor.css') 1684 1721 ]; 1685 1722 1686 1723 // load fontawesome 1687 1724 if (!empty($widget_settings) && !array_key_exists('enable_fontawesome', $widget_settings) || !empty($widget_settings['enable_fontawesome'])) { 1688 $styles['font-awesome-free'] = plugins_url('/ osm-map-elementor/assets/fontawesome-free-5.15.1/css/all.min.css');1725 $styles['font-awesome-free'] = plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/fontawesome-free-5.15.1/css/all.min.css'); 1689 1726 } 1690 1727 … … 1699 1736 // queue google maps key if provided 1700 1737 $admin_scripts = [ 1701 'osm-map-elementor-controls' => plugins_url('/ osm-map-elementor/assets/js/osm-map-controls.js')1738 'osm-map-elementor-controls' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/js/osm-map-controls.js') 1702 1739 ]; 1703 1740 … … 1717 1754 // queue widget view js 1718 1755 $scripts = [ 1719 'leaflet' => plugins_url('/ osm-map-elementor/assets/leaflet/leaflet.js'),1720 'mapbox-gl' => plugins_url('/ osm-map-elementor/assets/js/mapbox-gl.js'),1721 'leaflet-mapbox-gl' => plugins_url('/ osm-map-elementor/assets/leaflet/leaflet-mapbox-gl.js'),1722 'leaflet-fa-markers' => plugins_url('/ osm-map-elementor/assets/leaflet-fa-markers/L.Icon.FontAwesome.js'),1756 'leaflet' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/leaflet/leaflet.js'), 1757 'mapbox-gl' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/js/mapbox-gl.js'), 1758 'leaflet-mapbox-gl' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/leaflet/leaflet-mapbox-gl.js'), 1759 'leaflet-fa-markers' => plugins_url('/' . OSM_PLUGIN_FOLDER . '/assets/leaflet-fa-markers/L.Icon.FontAwesome.js'), 1723 1760 ]; 1724 1761 $deps = []; -
osm-map-elementor/trunk/readme.txt
r2481795 r2499825 1 1 === OSM Map Widget for Elementor === 2 2 Plugin Name: OSM Map Widget for Elementor 3 Version: 1.0. 63 Version: 1.0.7 4 4 Author: ACT Innovate 5 5 Author URI: https://github.com/flopperj/osm-map-elementor … … 8 8 Tested up to: 5.6 9 9 Requires PHP: 5.6 10 Stable tag: 1.0. 610 Stable tag: 1.0.7 11 11 License: GPLv3 12 12 License URI: https://www.gnu.org/licenses/gpl-3.0.html
Note: See TracChangeset
for help on using the changeset viewer.