bozdoz / wp-plugin-leaflet-map

Add leaflet maps to Wordpress with shortcodes
https://wordpress.org/plugins/leaflet-map/
GNU General Public License v2.0
140 stars 71 forks source link

tooltipAnchor #167

Closed hupe13 closed 1 year ago

hupe13 commented 1 year ago

Hi Bozdoz,

when answering this question, I missed tooltipAnchor. Is it possible to implement this? When I hover over the "Marker", the tooltip is not in the right position, see here.

Thank you very much.

bozdoz commented 1 year ago

I'll work on this

bozdoz commented 1 year ago

This good? https://github.com/bozdoz/wp-plugin-leaflet-map/pull/169

I'm not sure how to test this

bozdoz commented 1 year ago

@hupe13

hupe13 commented 1 year ago

I'm sorry, the svg markers thing is a misunderstanding, it just concerns markers. I have programmed it similar to the popupAnchor (class.marker-shortcode.php, construct-leaflet-map.js) and will make a pull-rquest tomorrow.

hupe13 commented 1 year ago

Somehow the pull request is too complicated for me, I'm sorry. I have changed 2 files (WordPress version 3.0.5)

*** a/wp-content/plugins/leaflet-map/shortcodes/class.marker-shortcode.php    
--- b/wp-content/plugins/leaflet-map/shortcodes/class.marker-shortcode.php  
***************
*** 79,80 ****
--- 79,81 ----
              'popupAnchor' => isset($popupanchor) ? $popupanchor : null,
+             'tooltipAnchor' => isset($tooltipanchor) ? $tooltipanchor : null,
              'svg' => isset($svg) ? $svg : null,
***************
*** 98,99 ****
--- 99,101 ----
              'popupAnchor' => FILTER_SANITIZE_STRING,
+             'tooltipAnchor' => FILTER_SANITIZE_STRING,
              'svg' => FILTER_VALIDATE_BOOLEAN,
*** a/wp-content/plugins/leaflet-map/scripts/construct-leaflet-map.js  
--- b/wp-content/plugins/leaflet-map/scripts/construct-leaflet-map.js  
***************
*** 361,362 ****
--- 361,363 ----
          'popupAnchor',
+         'tooltipAnchor',
        ];

(I generated a new construct-leaflet-map.min.js of course.)

And it works.

bozdoz commented 1 year ago

Added that code to the PR, if you wanted to double-check

hupe13 commented 1 year ago

You forgot a comma at the end of this line. I tested this only with leaflet-marker and an iconurl.