Changeset 3804102
- Timestamp:
- 11/16/2026 02:12:41 AM (less than one hour ago)
- Location:
- osm-map-elementor
- Files:
-
- 10 edited
- 1 copied
-
tags/1.5.0 (copied) (copied from osm-map-elementor/trunk )
-
tags/1.5.0/assets/leaflet-fa-markers/L.Icon.FontAwesome.js (modified) (2 diffs)
-
tags/1.5.0/constants.php (modified) (1 diff)
-
tags/1.5.0/osm-map-elementor.php (modified) (1 diff)
-
tags/1.5.0/osm-map.php (modified) (7 diffs)
-
tags/1.5.0/readme.txt (modified) (4 diffs)
-
trunk/assets/leaflet-fa-markers/L.Icon.FontAwesome.js (modified) (2 diffs)
-
trunk/constants.php (modified) (1 diff)
-
trunk/osm-map-elementor.php (modified) (1 diff)
-
trunk/osm-map.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
osm-map-elementor/tags/1.5.0/assets/leaflet-fa-markers/L.Icon.FontAwesome.js
r3107495 r3804102 20 20 21 21 return div; 22 }, 23 24 // L.Icon's createShadow calls _createIcon, which this class overrides, so it would add a second pin 25 createShadow: function () { 26 return null; 22 27 }, 23 28 … … 53 58 // container div 54 59 this.markerContainer = L.DomUtil.create("div", "leaflet-fa-markers"); 60 61 // scale around the pin tip so the tip stays on the coordinate 62 if (typeof options.markerScale === "number" && options.markerScale !== 1) { 63 this.markerContainer.style.transform = `scale(${options.markerScale})`; 64 this.markerContainer.style.transformOrigin = "16px 51px"; 65 } 55 66 56 67 // icon container div -
osm-map-elementor/tags/1.5.0/constants.php
r3804065 r3804102 6 6 define('OSM_MAP_SLUG', 'osm-map-elementor'); 7 7 define('OSM_PLUGIN_FOLDER', 'trunk' !== basename(__DIR__) ? basename(__DIR__) : OSM_MAP_SLUG); 8 define('OSM_MAP_VERSION', '1. 4.1');8 define('OSM_MAP_VERSION', '1.5.0'); 9 9 define('OSM_MAP_MIN_ELEMENTOR_VERSION', '3.30.0'); -
osm-map-elementor/tags/1.5.0/osm-map-elementor.php
r3804065 r3804102 3 3 * Plugin Name: OSM Map Widget for Elementor 4 4 * Description: A free Elementor Map Widget that Utilizes Open Street Map. Comes with features like adding multiple markers, and choosing from a library of custom tiles to change the look and feel. 5 * Version: 1. 4.15 * Version: 1.5.0 6 6 * Requires at least: 6.8 7 7 * Requires PHP: 7.4 -
osm-map-elementor/tags/1.5.0/osm-map.php
r3804065 r3804102 32 32 public static $slug = OSM_MAP_SLUG; 33 33 public static $ver = OSM_MAP_VERSION; 34 35 private const OSM_MARKER_SIZE_MIN = 25; 36 private const OSM_MARKER_SIZE_MAX = 200; 37 // Mirrors L.Icon.Default in the vendored Leaflet; Test_Vendored_Marker_Geometry fails if they drift. 38 private const OSM_DEFAULT_ICON_GEOMETRY = [ 39 'iconSize' => [25, 41], 40 'iconAnchor' => [12, 41], 41 'popupAnchor' => [1, -34], 42 'tooltipAnchor' => [16, -28], 43 'shadowSize' => [41, 41], 44 ]; 45 private const OSM_FA_MARKER_TOP = -50; 34 46 35 47 /** … … 621 633 622 634 $this->add_control( 635 'marker_size', 636 [ 637 'label' => __('Marker Size', 'osm-map-elementor'), 638 'type' => Controls_Manager::SLIDER, 639 'size_units' => ['%'], 640 'range' => [ 641 '%' => [ 642 'min' => self::OSM_MARKER_SIZE_MIN, 643 'max' => self::OSM_MARKER_SIZE_MAX, 644 'step' => 5, 645 ], 646 ], 647 'default' => [ 648 'unit' => '%', 649 'size' => 100, 650 ], 651 'description' => __('Scales the whole marker, including its icon and where its popup or tooltip opens.', 'osm-map-elementor'), 652 'condition' => [ 653 'icon_type' => ['', 'fontawesome'], 654 ], 655 ] 656 ); 657 658 $this->add_control( 623 659 'fontawesome_icon', 624 660 [ … … 1699 1735 <?php 1700 1736 $icon_type = !empty($settings['icon_type']) ? $settings['icon_type'] : null; 1737 $marker_scale = $this->osm_marker_scale($settings['marker_size'] ?? null); 1701 1738 switch ($icon_type): 1702 1739 case 'fontawesome': … … 1728 1765 $fa_icon_options['iconYOffset'] = $icon_offset['yOffset']; 1729 1766 } 1767 1768 if (1.0 !== $marker_scale) { 1769 $fa_icon_options['markerScale'] = $marker_scale; 1770 $fa_icon_options['popupAnchor'] = self::osm_scale_point([0, self::OSM_FA_MARKER_TOP], $marker_scale); 1771 } 1772 $fa_tooltip_offset = self::osm_scale_point([0, self::OSM_FA_MARKER_TOP], $marker_scale); 1730 1773 ?> 1731 1774 1732 markerOptions.icon = L.icon.fontAwesome(<?php echo wp_json_encode($fa_icon_options); ?>); 1775 const markerIconOptions = <?php echo wp_json_encode($fa_icon_options); ?>; 1776 const markerTooltipOffset = <?php echo wp_json_encode($fa_tooltip_offset); ?>; 1777 markerOptions.icon = L.icon.fontAwesome(markerIconOptions); 1733 1778 <?php 1734 1779 break; … … 1793 1838 markerOptions.icon = markerIcon; 1794 1839 <?php endif; ?> 1840 <?php 1841 break; 1842 default: 1843 if (1.0 !== $marker_scale): 1844 $default_icon_options = array_map(function ($point) use ($marker_scale) { 1845 return self::osm_scale_point($point, $marker_scale); 1846 }, self::OSM_DEFAULT_ICON_GEOMETRY); 1847 // L.Icon.Default only picks the 2x image on retina screens and prefixes this file name with its image path 1848 if ($marker_scale > 1.0) { 1849 $default_icon_options['iconUrl'] = 'marker-icon-2x.png'; 1850 } 1851 ?> 1852 const markerIconOptions = <?php echo wp_json_encode($default_icon_options); ?>; 1853 markerOptions.icon = new L.Icon.Default(markerIconOptions); 1854 <?php endif; ?> 1795 1855 <?php endswitch; ?> 1796 1856 … … 1876 1936 // update offset for fontawesome markers 1877 1937 tooltipOptions.direction = "top"; 1878 tooltipOptions.offset = [0, -50];1938 tooltipOptions.offset = markerTooltipOffset; 1879 1939 <?php endif; ?> 1880 1940 … … 2011 2071 2012 2072 /** 2073 * @param mixed $setting Elementor slider value. 2074 */ 2075 private function osm_marker_scale($setting): float 2076 { 2077 if (!is_array($setting) || !isset($setting['size']) || !is_numeric($setting['size'])) { 2078 return 1.0; 2079 } 2080 2081 $percent = max(self::OSM_MARKER_SIZE_MIN, min(self::OSM_MARKER_SIZE_MAX, (float) $setting['size'])); 2082 2083 return $percent / 100; 2084 } 2085 2086 /** 2087 * @param int[] $point 2088 * @return int[] 2089 */ 2090 private static function osm_scale_point(array $point, float $scale): array 2091 { 2092 return [(int) round($point[0] * $scale), (int) round($point[1] * $scale)]; 2093 } 2094 2095 /** 2013 2096 * Parses a "lat,lng" string into floats, rejecting malformed or out-of-range values. 2014 2097 * -
osm-map-elementor/tags/1.5.0/readme.txt
r3804065 r3804102 1 1 === OSM Map Widget for Elementor === 2 2 Plugin Name: OSM Map Widget for Elementor 3 Version: 1. 4.13 Version: 1.5.0 4 4 Author: Plugin Contributors 5 5 Author URI: https://github.com/flopperj/osm-map-elementor/graphs/contributors … … 9 9 Tested up to: 7.1 10 10 Requires PHP: 7.4 11 Stable tag: 1. 4.111 Stable tag: 1.5.0 12 12 License: GPLv3 13 13 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 65 65 66 66 == Changelog == 67 = 1.5.0 = 68 * NEW: Marker Size setting for the Default and Font Awesome marker icons. It scales the whole marker from 25% to 200%, and popups and tooltips follow the new size. Existing maps keep their current marker size. The Font Awesome Icon Size setting now scales together with the pin. Thanks to @xanhcloud24. 69 67 70 = 1.4.1 = 68 71 * IMPROVEMENT: Links that open in a new tab, such as map attributions and settings page links, now use rel="noopener noreferrer". The marker button uses rel="noopener" when it opens a new tab. Thanks to @frapsd. … … 98 101 99 102 == Upgrade Notice == 103 = 1.5.0 = 104 Adds a Marker Size setting for the Default and Font Awesome markers. 105 100 106 = 1.4.1 = 101 107 Links that open in a new tab now use rel="noopener". -
osm-map-elementor/trunk/assets/leaflet-fa-markers/L.Icon.FontAwesome.js
r3107495 r3804102 20 20 21 21 return div; 22 }, 23 24 // L.Icon's createShadow calls _createIcon, which this class overrides, so it would add a second pin 25 createShadow: function () { 26 return null; 22 27 }, 23 28 … … 53 58 // container div 54 59 this.markerContainer = L.DomUtil.create("div", "leaflet-fa-markers"); 60 61 // scale around the pin tip so the tip stays on the coordinate 62 if (typeof options.markerScale === "number" && options.markerScale !== 1) { 63 this.markerContainer.style.transform = `scale(${options.markerScale})`; 64 this.markerContainer.style.transformOrigin = "16px 51px"; 65 } 55 66 56 67 // icon container div -
osm-map-elementor/trunk/constants.php
r3804065 r3804102 6 6 define('OSM_MAP_SLUG', 'osm-map-elementor'); 7 7 define('OSM_PLUGIN_FOLDER', 'trunk' !== basename(__DIR__) ? basename(__DIR__) : OSM_MAP_SLUG); 8 define('OSM_MAP_VERSION', '1. 4.1');8 define('OSM_MAP_VERSION', '1.5.0'); 9 9 define('OSM_MAP_MIN_ELEMENTOR_VERSION', '3.30.0'); -
osm-map-elementor/trunk/osm-map-elementor.php
r3804065 r3804102 3 3 * Plugin Name: OSM Map Widget for Elementor 4 4 * Description: A free Elementor Map Widget that Utilizes Open Street Map. Comes with features like adding multiple markers, and choosing from a library of custom tiles to change the look and feel. 5 * Version: 1. 4.15 * Version: 1.5.0 6 6 * Requires at least: 6.8 7 7 * Requires PHP: 7.4 -
osm-map-elementor/trunk/osm-map.php
r3804065 r3804102 32 32 public static $slug = OSM_MAP_SLUG; 33 33 public static $ver = OSM_MAP_VERSION; 34 35 private const OSM_MARKER_SIZE_MIN = 25; 36 private const OSM_MARKER_SIZE_MAX = 200; 37 // Mirrors L.Icon.Default in the vendored Leaflet; Test_Vendored_Marker_Geometry fails if they drift. 38 private const OSM_DEFAULT_ICON_GEOMETRY = [ 39 'iconSize' => [25, 41], 40 'iconAnchor' => [12, 41], 41 'popupAnchor' => [1, -34], 42 'tooltipAnchor' => [16, -28], 43 'shadowSize' => [41, 41], 44 ]; 45 private const OSM_FA_MARKER_TOP = -50; 34 46 35 47 /** … … 621 633 622 634 $this->add_control( 635 'marker_size', 636 [ 637 'label' => __('Marker Size', 'osm-map-elementor'), 638 'type' => Controls_Manager::SLIDER, 639 'size_units' => ['%'], 640 'range' => [ 641 '%' => [ 642 'min' => self::OSM_MARKER_SIZE_MIN, 643 'max' => self::OSM_MARKER_SIZE_MAX, 644 'step' => 5, 645 ], 646 ], 647 'default' => [ 648 'unit' => '%', 649 'size' => 100, 650 ], 651 'description' => __('Scales the whole marker, including its icon and where its popup or tooltip opens.', 'osm-map-elementor'), 652 'condition' => [ 653 'icon_type' => ['', 'fontawesome'], 654 ], 655 ] 656 ); 657 658 $this->add_control( 623 659 'fontawesome_icon', 624 660 [ … … 1699 1735 <?php 1700 1736 $icon_type = !empty($settings['icon_type']) ? $settings['icon_type'] : null; 1737 $marker_scale = $this->osm_marker_scale($settings['marker_size'] ?? null); 1701 1738 switch ($icon_type): 1702 1739 case 'fontawesome': … … 1728 1765 $fa_icon_options['iconYOffset'] = $icon_offset['yOffset']; 1729 1766 } 1767 1768 if (1.0 !== $marker_scale) { 1769 $fa_icon_options['markerScale'] = $marker_scale; 1770 $fa_icon_options['popupAnchor'] = self::osm_scale_point([0, self::OSM_FA_MARKER_TOP], $marker_scale); 1771 } 1772 $fa_tooltip_offset = self::osm_scale_point([0, self::OSM_FA_MARKER_TOP], $marker_scale); 1730 1773 ?> 1731 1774 1732 markerOptions.icon = L.icon.fontAwesome(<?php echo wp_json_encode($fa_icon_options); ?>); 1775 const markerIconOptions = <?php echo wp_json_encode($fa_icon_options); ?>; 1776 const markerTooltipOffset = <?php echo wp_json_encode($fa_tooltip_offset); ?>; 1777 markerOptions.icon = L.icon.fontAwesome(markerIconOptions); 1733 1778 <?php 1734 1779 break; … … 1793 1838 markerOptions.icon = markerIcon; 1794 1839 <?php endif; ?> 1840 <?php 1841 break; 1842 default: 1843 if (1.0 !== $marker_scale): 1844 $default_icon_options = array_map(function ($point) use ($marker_scale) { 1845 return self::osm_scale_point($point, $marker_scale); 1846 }, self::OSM_DEFAULT_ICON_GEOMETRY); 1847 // L.Icon.Default only picks the 2x image on retina screens and prefixes this file name with its image path 1848 if ($marker_scale > 1.0) { 1849 $default_icon_options['iconUrl'] = 'marker-icon-2x.png'; 1850 } 1851 ?> 1852 const markerIconOptions = <?php echo wp_json_encode($default_icon_options); ?>; 1853 markerOptions.icon = new L.Icon.Default(markerIconOptions); 1854 <?php endif; ?> 1795 1855 <?php endswitch; ?> 1796 1856 … … 1876 1936 // update offset for fontawesome markers 1877 1937 tooltipOptions.direction = "top"; 1878 tooltipOptions.offset = [0, -50];1938 tooltipOptions.offset = markerTooltipOffset; 1879 1939 <?php endif; ?> 1880 1940 … … 2011 2071 2012 2072 /** 2073 * @param mixed $setting Elementor slider value. 2074 */ 2075 private function osm_marker_scale($setting): float 2076 { 2077 if (!is_array($setting) || !isset($setting['size']) || !is_numeric($setting['size'])) { 2078 return 1.0; 2079 } 2080 2081 $percent = max(self::OSM_MARKER_SIZE_MIN, min(self::OSM_MARKER_SIZE_MAX, (float) $setting['size'])); 2082 2083 return $percent / 100; 2084 } 2085 2086 /** 2087 * @param int[] $point 2088 * @return int[] 2089 */ 2090 private static function osm_scale_point(array $point, float $scale): array 2091 { 2092 return [(int) round($point[0] * $scale), (int) round($point[1] * $scale)]; 2093 } 2094 2095 /** 2013 2096 * Parses a "lat,lng" string into floats, rejecting malformed or out-of-range values. 2014 2097 * -
osm-map-elementor/trunk/readme.txt
r3804065 r3804102 1 1 === OSM Map Widget for Elementor === 2 2 Plugin Name: OSM Map Widget for Elementor 3 Version: 1. 4.13 Version: 1.5.0 4 4 Author: Plugin Contributors 5 5 Author URI: https://github.com/flopperj/osm-map-elementor/graphs/contributors … … 9 9 Tested up to: 7.1 10 10 Requires PHP: 7.4 11 Stable tag: 1. 4.111 Stable tag: 1.5.0 12 12 License: GPLv3 13 13 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 65 65 66 66 == Changelog == 67 = 1.5.0 = 68 * NEW: Marker Size setting for the Default and Font Awesome marker icons. It scales the whole marker from 25% to 200%, and popups and tooltips follow the new size. Existing maps keep their current marker size. The Font Awesome Icon Size setting now scales together with the pin. Thanks to @xanhcloud24. 69 67 70 = 1.4.1 = 68 71 * IMPROVEMENT: Links that open in a new tab, such as map attributions and settings page links, now use rel="noopener noreferrer". The marker button uses rel="noopener" when it opens a new tab. Thanks to @frapsd. … … 98 101 99 102 == Upgrade Notice == 103 = 1.5.0 = 104 Adds a Marker Size setting for the Default and Font Awesome markers. 105 100 106 = 1.4.1 = 101 107 Links that open in a new tab now use rel="noopener".
Note:
See TracChangeset
for help on using the changeset viewer.