diff --git a/BlueMapCore/src/main/webroot/js/libs/hud/HudInfo.js b/BlueMapCore/src/main/webroot/js/libs/hud/HudInfo.js index ba33699b..bb0ad040 100644 --- a/BlueMapCore/src/main/webroot/js/libs/hud/HudInfo.js +++ b/BlueMapCore/src/main/webroot/js/libs/hud/HudInfo.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { Raycaster, Vector2, + Vector3, BoxBufferGeometry, Mesh, MeshBasicMaterial @@ -155,10 +156,21 @@ export default class HudInfo { let lrpath = this.blueMap.dataRoot + this.blueMap.map + '/lowres/'; lrpath += pathFromCoords(lowresTile.x, lowresTile.y); lrpath += '.json'; + + //chunk + let chunkCoords = new Vector3(block.x, block.y, block.z).divide({x:16,y:16,z:16}).floor(); + let chunk = `x:${chunkCoords.x}, y:${chunkCoords.y}, z:${chunkCoords.z}`; + + //region + let regionCoords = new Vector2(block.x, block.z).divide({x:512,y:512}).floor(); + let region = `r.${regionCoords.x}.${regionCoords.y}.mca`; + $(`
${hrpath}
- ${lrpath} + ${lrpath}
+ chunk: ${chunk}
+ region: ${region}
`).appendTo(content); } diff --git a/BlueMapCore/src/main/webroot/js/libs/hud/PlayerMarker.js b/BlueMapCore/src/main/webroot/js/libs/hud/PlayerMarker.js index 544a8c84..2022c793 100644 --- a/BlueMapCore/src/main/webroot/js/libs/hud/PlayerMarker.js +++ b/BlueMapCore/src/main/webroot/js/libs/hud/PlayerMarker.js @@ -15,6 +15,8 @@ export default class PlayerMarker extends Marker { this.animationRunning = false; this.lastFrame = -1; + + this.follow = false; } setVisible(visible){ @@ -23,17 +25,18 @@ export default class PlayerMarker extends Marker { this.blueMap.updateFrame = true; if (!this.renderObject){ - let iconElement = $(`
${this.label}
`); - iconElement.find("img").click(this.onClick); + this.iconElement = $(`
${this.label}
`); + this.iconElement.find("img").click(this.onClick); + $(window).on('mousedown touchstart', this.onStopFollowing); - this.renderObject = new CSS2DObject(iconElement[0]); + this.renderObject = new CSS2DObject(this.iconElement[0]); this.renderObject.position.copy(this.position); this.renderObject.onBeforeRender = (renderer, scene, camera) => { let distanceSquared = this.position.distanceToSquared(camera.position); if (distanceSquared > 1000000) { - iconElement.addClass("distant"); + this.iconElement.addClass("distant"); } else { - iconElement.removeClass("distant"); + this.iconElement.removeClass("distant"); } this.updateRenderObject(this.renderObject, scene, camera); @@ -57,6 +60,11 @@ export default class PlayerMarker extends Marker { } else { this.renderObject.position.copy(this.position); } + + if (this.follow){ + this.blueMap.controls.targetPosition.x = this.position.x; + this.blueMap.controls.targetPosition.z = this.position.z; + } } }; @@ -86,7 +94,18 @@ export default class PlayerMarker extends Marker { }; onClick = () => { + this.follow = true; + this.iconElement.addClass("following"); - } + this.blueMap.controls.targetPosition.x = this.position.x; + this.blueMap.controls.targetPosition.z = this.position.z; + }; + + onStopFollowing = event => { + if(this.follow) { + this.follow = true; + this.iconElement.removeClass("following"); + } + }; } \ No newline at end of file diff --git a/BlueMapCore/src/main/webroot/style/modules/hudInfo.scss b/BlueMapCore/src/main/webroot/style/modules/hudInfo.scss index cfdf07e7..2c36e06d 100644 --- a/BlueMapCore/src/main/webroot/style/modules/hudInfo.scss +++ b/BlueMapCore/src/main/webroot/style/modules/hudInfo.scss @@ -96,6 +96,8 @@ image-rendering: pixelated; image-rendering: crisp-edges; + border: solid 2px transparent; + transition: all 0.3s; } @@ -115,10 +117,18 @@ img { width: 16px; height: 16px; + + border-width: 1px; } .nameplate { opacity: 0; } } + + &.following { + img { + border-color: white; + } + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index bbab783f..d58794f7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -coreVersion=0.9.0 +coreVersion=0.10.0 targetVersion=mc1.16