diff --git a/common/webapp/public/lang/en.conf b/common/webapp/public/lang/en.conf index b3fbdfd9..55ba3045 100644 --- a/common/webapp/public/lang/en.conf +++ b/common/webapp/public/lang/en.conf @@ -135,6 +135,7 @@ sun: "Sun" block: "Block" } + clipboard: "click to copy" } info: { title: "Info" diff --git a/common/webapp/src/js/PopupMarker.js b/common/webapp/src/js/PopupMarker.js index 1cf38b7b..0e41a2dd 100644 --- a/common/webapp/src/js/PopupMarker.js +++ b/common/webapp/src/js/PopupMarker.js @@ -70,6 +70,10 @@ export class PopupMarker extends Marker { return true; } + static blockClipboardFormat = (pos, isHires) => isHires ? `${pos.x} ${pos.y} ${pos.z}` : `${pos.x} ${pos.z}`; + static chunkClipboardFormat = (pos, isHires) => isHires ? `${pos.x} ${pos.y} ${pos.z}` : `${pos.x} ${pos.z}`; + static regionClipboardFormat = pos => `r.${pos.x}.${pos.z}.mca` + onMapInteraction = evt => { let isHires = true; let int = evt.detail.hiresHit; @@ -96,7 +100,9 @@ export class PopupMarker extends Marker { if (isHires) { this.element.innerHTML = ` -
+
${i18n.t("blockTooltip.block")}:
x: ${this.position.x}
@@ -107,7 +113,9 @@ export class PopupMarker extends Marker { `; } else { this.element.innerHTML = ` -
+
${i18n.t("blockTooltip.position")}:
x: ${this.position.x}
@@ -122,18 +130,40 @@ export class PopupMarker extends Marker { let regionCoords = new Vector2(this.position.x, this.position.z).divideScalar(512).floor(); let regionFile = `r.${regionCoords.x}.${regionCoords.y}.mca`; + if (isHires) { + this.element.innerHTML += ` +
+
+
${i18n.t("blockTooltip.chunk")}:
+
+
x: ${chunkCoords.x}
+
y: ${chunkCoords.y}
+
z: ${chunkCoords.z}
+
+
+ `; + } else { + this.element.innerHTML += ` +
+
+
${i18n.t("blockTooltip.chunk")}:
+
+
x: ${chunkCoords.x}
+
z: ${chunkCoords.z}
+
+
+ `; + } + this.element.innerHTML += `
-
-
${i18n.t("blockTooltip.chunk")}:
-
-
x: ${chunkCoords.x}
-
y: ${chunkCoords.y}
-
z: ${chunkCoords.z}
-
-
-
-
+
${i18n.t("blockTooltip.region.region")}:
x: ${regionCoords.x}
diff --git a/common/webapp/src/scss/markers.scss b/common/webapp/src/scss/markers.scss index 4c5c3fde..7c1758f4 100644 --- a/common/webapp/src/scss/markers.scss +++ b/common/webapp/src/scss/markers.scss @@ -89,6 +89,43 @@ line-height: 1.2em; .group { + + &[data-tooltip] { + + position: relative; + + pointer-events: auto; + user-select: none; + cursor: pointer; + + margin: -0.5em; + padding: 0.5em; + + &:hover::before { + display: block; + position: absolute; + z-index: 1; + + left: 50%; + bottom: calc(100% + 0.5em); + transform: translate(-50%, 0); + + content: attr(data-tooltip); + + background: var(--theme-bg); + color: var(--theme-fg-light); + filter: drop-shadow(1px 1px 3px #0008); + font-size: 0.75em; + line-height: 1em; + padding: .5em; + } + + &:active { + background-color: var(--theme-bg-light); + } + + } + > .label { position: relative; top: 0;