@aibee/crc-bmap 0.0.89 → 0.0.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bmap.esm.js CHANGED
@@ -969,6 +969,7 @@ var Overlay = class extends EventDispatcher {
969
969
  var defaultOptions3 = {
970
970
  texts: [{ text: "" }],
971
971
  level: 1,
972
+ icon_position: "bottom",
972
973
  collision_enable: true,
973
974
  opacity: 1,
974
975
  id: "",
@@ -1010,7 +1011,7 @@ var Poi = class extends EventDispatcher2 {
1010
1011
  this.addEventListener("change-icon", ({ value }) => {
1011
1012
  if (value) {
1012
1013
  if (!this.img) {
1013
- this.div.appendChild(this.initIcon());
1014
+ this.addIcon();
1014
1015
  this._changePosition();
1015
1016
  } else {
1016
1017
  this.img.setAttribute("src", value);
@@ -1024,11 +1025,7 @@ var Poi = class extends EventDispatcher2 {
1024
1025
  });
1025
1026
  this.addEventListener("change-texts", ({ value }) => {
1026
1027
  this.div.removeChild(this.textDiv);
1027
- if (this.div.firstChild) {
1028
- this.div.insertBefore(this.initText(), this.div.firstChild);
1029
- } else {
1030
- this.div.appendChild(this.initText());
1031
- }
1028
+ this.addText();
1032
1029
  this.resetSize();
1033
1030
  });
1034
1031
  this.addEventListener("change-opacity", ({ value }) => {
@@ -1086,9 +1083,10 @@ var Poi = class extends EventDispatcher2 {
1086
1083
  }
1087
1084
  initDiv() {
1088
1085
  const div = document.createElement("div");
1089
- div.appendChild(this.initText());
1086
+ this.div = div;
1087
+ this.addText();
1090
1088
  if (this.options.icon) {
1091
- div.appendChild(this.initIcon());
1089
+ this.addIcon();
1092
1090
  }
1093
1091
  div.style.fontSize = `12px`;
1094
1092
  div.style.textShadow = `#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0`;
@@ -1101,10 +1099,35 @@ var Poi = class extends EventDispatcher2 {
1101
1099
  this.overlay.div.style.pointerEvents = `none`;
1102
1100
  this.overlay.div.style.userSelect = `none`;
1103
1101
  this.overlay.div.appendChild(div);
1104
- this.div = div;
1105
1102
  this.resetSize();
1106
1103
  return div;
1107
1104
  }
1105
+ addIcon() {
1106
+ if (!this.img) {
1107
+ const icon = this.initIcon();
1108
+ if (this.options.icon_position === "top") {
1109
+ if (this.div.firstChild) {
1110
+ this.div.insertBefore(icon, this.div.firstChild);
1111
+ } else {
1112
+ this.div.appendChild(icon);
1113
+ }
1114
+ } else {
1115
+ this.div.appendChild(icon);
1116
+ }
1117
+ }
1118
+ }
1119
+ addText() {
1120
+ const text = this.initText();
1121
+ if (this.options.icon_position === "top") {
1122
+ this.div.appendChild(text);
1123
+ } else {
1124
+ if (this.div.firstChild) {
1125
+ this.div.insertBefore(text, this.div.firstChild);
1126
+ } else {
1127
+ this.div.appendChild(text);
1128
+ }
1129
+ }
1130
+ }
1108
1131
  getPosition() {
1109
1132
  return this.position;
1110
1133
  }