Exclude editor visuals from screen captures

This commit is contained in:
Danny McGee
2024-02-28 02:30:19 -05:00
parent c57f0588af
commit 04ba5bad69
5 changed files with 67 additions and 28 deletions
+9 -21
View File
@@ -22,7 +22,6 @@ import "./app.element.scss"
@customElement("app-root")
export class AppElement extends LitElement {
@state() imageCaptureUrl?: string;
@state() realtimeCapture = true;
@state() hierarchyWidth = 256;
@state() resizing = false;
@@ -52,12 +51,9 @@ export class AppElement extends LitElement {
}
@on("entity-changes")
@debounce(1000 / 24)
onStudioChanges(): void {
if (this.realtimeCapture) {
this.requestScreenshot_realtime();
} else {
this.requestScreenshot_delayed();
}
studio.requestScreenshot();
}
@on("viewport-resized")
@@ -67,16 +63,6 @@ export class AppElement extends LitElement {
studio.requestScreenshot();
}
@debounce(1000 / 24, { maxWait: 1000 / 5 })
requestScreenshot_realtime() {
studio.requestScreenshot();
}
@debounce(1000 / 24)
requestScreenshot_delayed() {
studio.requestScreenshot();
}
@on("screenshot-ready")
onScreenshotReady({ detail: screenshot }: ScreenshotReadyEvent) {
const prevUrl = this.imageCaptureUrl;
@@ -101,11 +87,6 @@ export class AppElement extends LitElement {
this.hierarchyWidth = Math.max(Math.min(updated, 512), 128);
}
toggleRealtimeCapture(event: InputEvent): void {
const { checked } = event.target as HTMLInputElement;
this.realtimeCapture = checked;
}
refreshSeed(): void {
this.seed = randomSeed();
}
@@ -184,6 +165,11 @@ export class AppElement extends LitElement {
</div>
</div>
${/*
FIXME: Real-time capture is not really feasible until we can come up
with a more elegant way to exclude the world grid, gizmos, etc.
from the captured image
<div class="config v-start h-end">
<label class="config-checkbox">
<input
@@ -194,6 +180,8 @@ export class AppElement extends LitElement {
Realtime Capture
</label>
</div>
*/
nothing}
${this.loading ? html`
<!-- TODO: Animated spinner or something -- talk to our designers -->