mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-30 23:53:57 +02:00
wip
This commit is contained in:
@@ -5,9 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="$style.root" class="_pageScrollable">
|
<div :class="$style.root" class="_pageScrollable">
|
||||||
<div :class="$style.screen">
|
<div :class="[$style.screen, { [$style.zen]: isZenMode }]">
|
||||||
<canvas ref="canvas" :class="$style.canvas" @keydown="onKeydown" @wheel="onWheel"></canvas>
|
<canvas ref="canvas" :class="$style.canvas" @keydown="onKeydown" @wheel="onWheel"></canvas>
|
||||||
|
|
||||||
|
<template v-if="!isZenMode">
|
||||||
<div v-if="engine != null" class="_buttonsCenter" :class="$style.overlayControls">
|
<div v-if="engine != null" class="_buttonsCenter" :class="$style.overlayControls">
|
||||||
<template v-if="engine.isEditMode.value">
|
<template v-if="engine.isEditMode.value">
|
||||||
<MkButton v-if="engine.ui.isGrabbing" @click="endGrabbing"><i class="ti ti-check"></i> (E)</MkButton>
|
<MkButton v-if="engine.ui.isGrabbing" @click="endGrabbing"><i class="ti ti-check"></i> (E)</MkButton>
|
||||||
@@ -34,19 +35,22 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="!isZenMode">
|
||||||
<div v-if="engine != null" class="_buttons" :class="$style.controls">
|
<div v-if="engine != null" class="_buttons" :class="$style.controls">
|
||||||
<!--<MkButton v-for="action in actions" :key="action.key" @click="action.fn">{{ action.label }}{{ hotkeyToLabel(action.hotkey) }}</MkButton>-->
|
<!--<MkButton v-for="action in actions" :key="action.key" @click="action.fn">{{ action.label }}{{ hotkeyToLabel(action.hotkey) }}</MkButton>-->
|
||||||
<MkButton @click="toggleLight">Toggle Light</MkButton>
|
<MkButton @click="toggleLight">Toggle Light</MkButton>
|
||||||
<MkButton :primary="engine.isEditMode.value" @click="toggleEditMode">Edit mode: {{ engine.isEditMode.value ? 'on' : 'off' }}</MkButton>
|
<MkButton :primary="engine.isEditMode.value" @click="toggleEditMode">Edit mode: {{ engine.isEditMode.value ? 'on' : 'off' }}</MkButton>
|
||||||
<MkButton @click="addObject">addObject</MkButton>
|
<MkButton @click="addObject">addObject</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue';
|
import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, shallowRef, useTemplateRef, watch } from 'vue';
|
||||||
import { definePage } from '@/page.js';
|
import { definePage } from '@/page.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { ensureSignin } from '@/i';
|
import { ensureSignin } from '@/i';
|
||||||
@@ -118,9 +122,13 @@ const actions = computed<Action[]>(() => {
|
|||||||
return actions;
|
return actions;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isZenMode = ref(false);
|
||||||
|
|
||||||
function onKeydown(ev: KeyboardEvent) {
|
function onKeydown(ev: KeyboardEvent) {
|
||||||
if (engine.value == null) return;
|
if (engine.value == null) return;
|
||||||
|
|
||||||
|
console.log(ev.code);
|
||||||
|
|
||||||
if (ev.code === 'KeyE') {
|
if (ev.code === 'KeyE') {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
@@ -149,6 +157,13 @@ function onKeydown(ev: KeyboardEvent) {
|
|||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
toggleEditMode();
|
toggleEditMode();
|
||||||
|
} else if (ev.code === 'KeyZ') {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
isZenMode.value = !isZenMode.value;
|
||||||
|
nextTick(() => {
|
||||||
|
resize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,6 +574,9 @@ definePage(() => ({
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 90cqh;
|
height: 90cqh;
|
||||||
}
|
}
|
||||||
|
.screen.zen {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.canvas {
|
.canvas {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
Reference in New Issue
Block a user