mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
[ts][player] Closes #1238, disable pause/play when controls are hidden via options.
This commit is contained in:
parent
66689b3800
commit
1cf8a72e30
@ -10820,6 +10820,8 @@ var spine;
|
|||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (!_this.config.showControls)
|
||||||
|
return;
|
||||||
if (_this.paused)
|
if (_this.paused)
|
||||||
_this.play();
|
_this.play();
|
||||||
else
|
else
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -10157,6 +10157,8 @@ var spine;
|
|||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (!_this.config.showControls)
|
||||||
|
return;
|
||||||
if (_this.paused)
|
if (_this.paused)
|
||||||
_this.play();
|
_this.play();
|
||||||
else
|
else
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -29,7 +29,8 @@ body {
|
|||||||
backgroundColor: "#cccccc",
|
backgroundColor: "#cccccc",
|
||||||
viewport: {
|
viewport: {
|
||||||
debugRender: true,
|
debugRender: true,
|
||||||
}
|
},
|
||||||
|
showControls: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
/*// Creates a new spine player with a transparent background,
|
/*// Creates a new spine player with a transparent background,
|
||||||
|
|||||||
@ -989,6 +989,7 @@
|
|||||||
if (target) {
|
if (target) {
|
||||||
target = null;
|
target = null;
|
||||||
} else {
|
} else {
|
||||||
|
if (!this.config.showControls) return;
|
||||||
if (this.paused)
|
if (this.paused)
|
||||||
this.play()
|
this.play()
|
||||||
else
|
else
|
||||||
@ -1048,22 +1049,22 @@
|
|||||||
let handleHover = (mouseX: number, mouseY: number) => {
|
let handleHover = (mouseX: number, mouseY: number) => {
|
||||||
if (!this.config.showControls) return;
|
if (!this.config.showControls) return;
|
||||||
|
|
||||||
let popup = findWithClass(this.dom, "spine-player-popup");
|
let popup = findWithClass(this.dom, "spine-player-popup");
|
||||||
mouseOverControls = overlap(mouseX, mouseY, this.playerControls.getBoundingClientRect());
|
mouseOverControls = overlap(mouseX, mouseY, this.playerControls.getBoundingClientRect());
|
||||||
mouseOverCanvas = overlap(mouseX, mouseY, this.canvas.getBoundingClientRect());
|
mouseOverCanvas = overlap(mouseX, mouseY, this.canvas.getBoundingClientRect());
|
||||||
clearTimeout(this.cancelId);
|
clearTimeout(this.cancelId);
|
||||||
let hide = popup.length == 0 && !mouseOverControls && !mouseOverCanvas && !this.paused;
|
let hide = popup.length == 0 && !mouseOverControls && !mouseOverCanvas && !this.paused;
|
||||||
if (hide) {
|
if (hide) {
|
||||||
this.playerControls.classList.add("spine-player-controls-hidden");
|
this.playerControls.classList.add("spine-player-controls-hidden");
|
||||||
} else {
|
} else {
|
||||||
this.playerControls.classList.remove("spine-player-controls-hidden");
|
this.playerControls.classList.remove("spine-player-controls-hidden");
|
||||||
}
|
}
|
||||||
if (!mouseOverControls && popup.length == 0 && !this.paused) {
|
if (!mouseOverControls && popup.length == 0 && !this.paused) {
|
||||||
let remove = () => {
|
let remove = () => {
|
||||||
if (!this.paused) this.playerControls.classList.add("spine-player-controls-hidden");
|
if (!this.paused) this.playerControls.classList.add("spine-player-controls-hidden");
|
||||||
};
|
};
|
||||||
this.cancelId = setTimeout(remove, 1000);
|
this.cancelId = setTimeout(remove, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let overlap = (mouseX: number, mouseY: number, rect: DOMRect | ClientRect): boolean => {
|
let overlap = (mouseX: number, mouseY: number, rect: DOMRect | ClientRect): boolean => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user