Commit 907329b1 authored by Michael Underwood's avatar Michael Underwood
Browse files

Improve detection of when a marker should not render the default icon

Resolves #266, again!
parent 4f50c3a6
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Unreleased]

### Fixed

- Improved how the `<LMarker>` decides when not to render the default icon, resolving an additional issue surfaced
  in [#266 Vue-leaflet LPopup does not update with prop change](https://github.com/vue-leaflet/vue-leaflet/issues/266).


## [0.8.3] - 2023-02-12

### Fixed
@@ -106,7 +114,11 @@ The following releases were created before the addition of this changelog:
* [0.1.2], 2020-10-09


[unreleased]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.7.0...HEAD
[unreleased]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.8.3...HEAD
[0.8.1]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.8.2...v0.8.3
[0.8.1]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.8.1...v0.8.2
[0.8.1]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.8.0...v0.8.1
[0.8.0]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.6.1...v0.7.0
[0.6.1]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/vue-leaflet/vue-leaflet/compare/v0.5.0...v0.6.0
+13 −7
Original line number Diff line number Diff line
import { propsToLeafletOptions } from "../utils";
import { layerProps, setupLayer } from "./layer";

const unrenderedContentTypes = ["Symbol(Comment)", "Symbol(Text)"];
const unrenderedComponentNames = ["LTooltip", "LPopup"];

export const markerProps = {
  ...layerProps,
  draggable: {
@@ -73,12 +76,15 @@ export const shouldBlankIcon = (options, context) => {
  // Vue mounts the inner content and vue-leaflet updates the marker with it.
  // See https://github.com/vue-leaflet/vue-leaflet/issues/170
  const slotContent = context.slots.default && context.slots.default();
  if (
    slotContent &&
    slotContent.some((el) => !["LTooltip", "LPopup"].includes(el.type.name))
  ) {
    return true;
  }

  return false;
  return (
    slotContent && slotContent.length && slotContent.some(contentIsRendered)
  );
};

function contentIsRendered(el) {
  if (unrenderedContentTypes.includes(el.type.toString())) return false;
  if (unrenderedComponentNames.includes(el.type.name)) return false;

  return true;
}