From 031ff12873e213db05fca1daee7a386103b1127c Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 10 Jan 2018 15:02:14 +0100 Subject: [PATCH 1/3] document tooltipAnchor option --- src/layer/marker/Icon.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layer/marker/Icon.js b/src/layer/marker/Icon.js index 22e56b72..6042aca1 100644 --- a/src/layer/marker/Icon.js +++ b/src/layer/marker/Icon.js @@ -54,6 +54,9 @@ export var Icon = Class.extend({ * @option popupAnchor: Point = null * The coordinates of the point from which popups will "open", relative to the icon anchor. * + * @option tooltipAnchor: Point = null + * The coordinates of the point from which tooltips will "open", relative to the icon anchor. + * * @option shadowUrl: String = null * The URL to the icon shadow image. If not specified, no shadow image will be created. * From 5c2d3d8ebc0eeb9e9f6c36690a0847f6adb27e6b Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 10 Jan 2018 15:03:18 +0100 Subject: [PATCH 2/3] move tooltipAnchor and popupAnchor defaults from Marker to Icon --- src/layer/marker/Icon.js | 5 +++++ src/layer/marker/Marker.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/layer/marker/Icon.js b/src/layer/marker/Icon.js index 6042aca1..4b67aefa 100644 --- a/src/layer/marker/Icon.js +++ b/src/layer/marker/Icon.js @@ -73,6 +73,11 @@ export var Icon = Class.extend({ * A custom class name to assign to both icon and shadow images. Empty by default. */ + options: { + popupAnchor: [0, 0], + tooltipAnchor: [0, 0], + }, + initialize: function (options) { setOptions(this, options); }, diff --git a/src/layer/marker/Marker.js b/src/layer/marker/Marker.js index 09c33903..b3ba5921 100644 --- a/src/layer/marker/Marker.js +++ b/src/layer/marker/Marker.js @@ -349,11 +349,11 @@ export var Marker = Layer.extend({ }, _getPopupAnchor: function () { - return this.options.icon.options.popupAnchor || [0, 0]; + return this.options.icon.options.popupAnchor; }, _getTooltipAnchor: function () { - return this.options.icon.options.tooltipAnchor || [0, 0]; + return this.options.icon.options.tooltipAnchor; } }); From 9796e1183ef1649e00a273757dbe63d160dead24 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 10 Jan 2018 15:06:56 +0100 Subject: [PATCH 3/3] update docs --- src/layer/marker/Icon.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layer/marker/Icon.js b/src/layer/marker/Icon.js index 4b67aefa..a0dc88c6 100644 --- a/src/layer/marker/Icon.js +++ b/src/layer/marker/Icon.js @@ -51,10 +51,10 @@ export var Icon = Class.extend({ * will be aligned so that this point is at the marker's geographical location. Centered * by default if size is specified, also can be set in CSS with negative margins. * - * @option popupAnchor: Point = null + * @option popupAnchor: Point = [0, 0] * The coordinates of the point from which popups will "open", relative to the icon anchor. * - * @option tooltipAnchor: Point = null + * @option tooltipAnchor: Point = [0, 0] * The coordinates of the point from which tooltips will "open", relative to the icon anchor. * * @option shadowUrl: String = null