1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-05 16:24:10 +02:00
This commit is contained in:
syuilo
2026-02-17 13:46:58 +09:00
parent 3375220aee
commit af560802b3
2 changed files with 43 additions and 37 deletions

View File

@@ -32,7 +32,7 @@ import { i18n } from '@/i18n.js';
import { ensureSignin } from '@/i'; import { ensureSignin } from '@/i';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { RoomEngine } from '@/utility/room/engine.js'; import { RoomEngine } from '@/utility/room/engine.js';
import { getObjectDef } from '@/utility/room/object-defs.js'; import { getObjectDef, OBJECT_DEFS } from '@/utility/room/object-defs.js';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
@@ -472,9 +472,15 @@ function toggleEditMode() {
canvas.value!.focus(); canvas.value!.focus();
} }
function addObject() { function addObject(ev: PointerEvent) {
engine.value?.addObject('tabletopDigitalClock'); if (engine.value == null) return;
os.popupMenu(OBJECT_DEFS.map(def => ({
text: def.id,
action: () => {
engine.value?.addObject(def.id);
canvas.value!.focus(); canvas.value!.focus();
},
})), ev.currentTarget ?? ev.target);
} }
definePage(() => ({ definePage(() => ({

View File

@@ -14,7 +14,6 @@ export const tabletopDigitalClock = defineObject({
createInstance: ({ room, root }) => { createInstance: ({ room, root }) => {
return { return {
onInited: () => { onInited: () => {
room.intervalIds.push(window.setInterval(() => {
const meshes = { const meshes = {
'1a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1A__')), '1a': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1A__')),
'1b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1B__')), '1b': root.getChildMeshes().find(m => m.name.includes('__TIME_7SEG_1B__')),
@@ -48,6 +47,7 @@ export const tabletopDigitalClock = defineObject({
const colonMeshes = root.getChildMeshes().filter(m => m.name.includes('__TIME_7SEG_COLON__')); const colonMeshes = root.getChildMeshes().filter(m => m.name.includes('__TIME_7SEG_COLON__'));
room.intervalIds.push(window.setInterval(() => {
const onMeshes = get7segMeshesOfCurrentTime(meshes); const onMeshes = get7segMeshesOfCurrentTime(meshes);
for (const mesh of Object.values(meshes)) { for (const mesh of Object.values(meshes)) {