1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Fix some literal edge cases

This commit is contained in:
Exund 2020-09-20 00:33:54 +02:00
parent c4f2379010
commit df97bff53f
3 changed files with 18 additions and 6 deletions

View File

@ -231,7 +231,15 @@ export class Application {
* @param {MouseEvent} event * @param {MouseEvent} event
*/ */
handleMousemove(event) { handleMousemove(event) {
this.mousePosition = new Vector(event.clientX, event.clientY); let x = event.clientX;
let y = event.clientY;
if (event.type === "mouseout" || event.type === "mouseleave") {
x = -1;
y = -1;
}
this.mousePosition = new Vector(x, y);
} }
/** /**

View File

@ -862,7 +862,7 @@ export class Camera extends BasicSerializableObject {
* @param {number} dt * @param {number} dt
*/ */
internalUpdateMousePanning(now, dt) { internalUpdateMousePanning(now, dt) {
if (!this.root.app.settings.getAllSettings().enableMousePan) { if (!this.root.app.settings.getAllSettings().enableMousePan || !this.root.app.focused) {
// Not enabled // Not enabled
return; return;
} }
@ -882,10 +882,10 @@ export class Camera extends BasicSerializableObject {
} }
if ( if (
mousePos.x < 0 || mousePos.x <= 0 ||
mousePos.y < 0 || mousePos.y <= 0 ||
mousePos.x > this.root.gameWidth || mousePos.x >= this.root.gameWidth ||
mousePos.y > this.root.gameHeight mousePos.y >= this.root.gameHeight
) { ) {
// Out of screen // Out of screen
return; return;

View File

@ -48,6 +48,10 @@ export class HUDShapeViewer extends BaseHUDPart {
this.close(); this.close();
} }
isBlockingOverlay() {
return this.visible;
}
/** /**
* Called when the copying of a key was requested * Called when the copying of a key was requested
*/ */