mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-12-01 15:03:24 +01:00
Catch web-app error and cancel alert animations
This commit is contained in:
parent
2c1fb0a8db
commit
a217ddf045
@ -475,15 +475,15 @@ export default class BlueMap {
|
|||||||
let displayAlert = () => {
|
let displayAlert = () => {
|
||||||
let alert = $(`<div class="alert box" data-alert-id="${id}" style="display: none;"><div class="alert-close-button"></div>${content}</div>`).appendTo(alertBox);
|
let alert = $(`<div class="alert box" data-alert-id="${id}" style="display: none;"><div class="alert-close-button"></div>${content}</div>`).appendTo(alertBox);
|
||||||
alert.find('.alert-close-button').click(() => {
|
alert.find('.alert-close-button').click(() => {
|
||||||
alert.fadeOut(200, () => alert.remove());
|
alert.stop().fadeOut(200, () => alert.remove());
|
||||||
});
|
});
|
||||||
alert.fadeIn(200);
|
alert.stop().fadeIn(200);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (id !== undefined) {
|
if (id !== undefined) {
|
||||||
let sameAlert = alertBox.find(`.alert[data-alert-id=${id}]`);
|
let sameAlert = alertBox.find(`.alert[data-alert-id=${id}]`);
|
||||||
if (sameAlert.length > 0) {
|
if (sameAlert.length > 0) {
|
||||||
alertBox.fadeOut(200, () => {
|
alertBox.stop().fadeOut(200, () => {
|
||||||
alertBox.html('');
|
alertBox.html('');
|
||||||
alertBox.show();
|
alertBox.show();
|
||||||
});
|
});
|
||||||
@ -493,7 +493,7 @@ export default class BlueMap {
|
|||||||
|
|
||||||
let oldAlerts = alertBox.find('.alert');
|
let oldAlerts = alertBox.find('.alert');
|
||||||
if (oldAlerts.length > 0){
|
if (oldAlerts.length > 0){
|
||||||
alertBox.fadeOut(200, () => {
|
alertBox.stop().fadeOut(200, () => {
|
||||||
alertBox.html('');
|
alertBox.html('');
|
||||||
alertBox.show();
|
alertBox.show();
|
||||||
displayAlert();
|
displayAlert();
|
||||||
|
@ -228,6 +228,8 @@ export default class Controls {
|
|||||||
return this.heightScene.children.filter(child => inTile(child.position, targetPos))
|
return this.heightScene.children.filter(child => inTile(child.position, targetPos))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// check hight at target
|
||||||
|
try {
|
||||||
let rayStart = new Vector3(this.targetPosition.x, 300, this.targetPosition.z);
|
let rayStart = new Vector3(this.targetPosition.x, 300, this.targetPosition.z);
|
||||||
this.raycaster.set(rayStart, this.rayDirection);
|
this.raycaster.set(rayStart, this.rayDirection);
|
||||||
this.raycaster.near = 1;
|
this.raycaster.near = 1;
|
||||||
@ -236,20 +238,20 @@ export default class Controls {
|
|||||||
|
|
||||||
if (intersects.length > 0) {
|
if (intersects.length > 0) {
|
||||||
this.minHeight = intersects[0].point.y;
|
this.minHeight = intersects[0].point.y;
|
||||||
//this.targetPosition.y = this.minHeight;
|
|
||||||
} else {
|
|
||||||
//this.targetPosition.y = 0;
|
|
||||||
}
|
}
|
||||||
|
} catch (ignore){}
|
||||||
|
|
||||||
rayStart.set(this.camera.position.x, 300, this.camera.position.z);
|
// check height at camera
|
||||||
|
try {
|
||||||
|
let rayStart = new Vector3(this.camera.position.x, 300, this.camera.position.z);
|
||||||
this.raycaster.set(rayStart, this.rayDirection);
|
this.raycaster.set(rayStart, this.rayDirection);
|
||||||
intersects.length = 0;
|
let intersects = this.raycaster.intersectObjects(tileChildren(this.camera.position));
|
||||||
intersects = this.raycaster.intersectObjects(tileChildren(this.camera.position));
|
|
||||||
if (intersects.length > 0) {
|
if (intersects.length > 0) {
|
||||||
if (intersects[0].point.y > this.minHeight) {
|
if (intersects[0].point.y > this.minHeight) {
|
||||||
this.minHeight = intersects[0].point.y;
|
this.minHeight = intersects[0].point.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (ignore){}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMouseMoves = () => {
|
updateMouseMoves = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user