From 4817e1b01a09deb0064993a4b90c7d1830dc2de3 Mon Sep 17 00:00:00 2001 From: qiang Date: Thu, 4 Nov 2021 21:05:30 +0800 Subject: [PATCH] fix: map -> marker -> callout style (question/133590) --- src/platforms/h5/view/components/map/map-marker.js | 7 ++++--- src/platforms/h5/view/components/map/maps/callout.js | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/platforms/h5/view/components/map/map-marker.js b/src/platforms/h5/view/components/map/map-marker.js index 3d47d00f4..63e35e282 100644 --- a/src/platforms/h5/view/components/map/map-marker.js +++ b/src/platforms/h5/view/components/map/map-marker.js @@ -131,7 +131,7 @@ export default { w = img.width / 2 h = img.height / 2 } - const top = h - (h - y) + const top = h - (h - y * h) if ('MarkerImage' in maps) { icon = new maps.MarkerImage( img.src, @@ -189,6 +189,7 @@ export default { let callout = marker.callout let calloutStyle if (calloutOpt.content || title) { + const boxShadow = '0px 0px 3px 1px rgba(0,0,0,0.5)' calloutStyle = calloutOpt.content ? { position, @@ -200,7 +201,7 @@ export default { borderRadius: calloutOpt.borderRadius, bgColor: calloutOpt.bgColor, padding: calloutOpt.padding, - boxShadow: calloutOpt.boxShadow, + boxShadow: calloutOpt.boxShadow || boxShadow, display: calloutOpt.display } : { @@ -208,7 +209,7 @@ export default { map, top, content: title, - boxShadow: '0px 0px 3px 1px rgba(0,0,0,0.5)' + boxShadow: boxShadow } if (callout) { callout.setOption(calloutStyle) diff --git a/src/platforms/h5/view/components/map/maps/callout.js b/src/platforms/h5/view/components/map/maps/callout.js index 3e9f81327..5d7a8fa54 100644 --- a/src/platforms/h5/view/components/map/maps/callout.js +++ b/src/platforms/h5/view/components/map/maps/callout.js @@ -107,6 +107,11 @@ export function createCallout (maps) { destroy = onRemove } - Callout.prototype = overlay + const prototype = Callout.prototype + for (const key in overlay) { + if (!(key in prototype)) { + prototype[key] = overlay[key] + } + } return Callout } -- GitLab