game scenarios

This commit is contained in:
2025-03-14 19:13:52 +02:00
parent 96869a62e4
commit 6aad752ce3
13 changed files with 396 additions and 127 deletions
@@ -0,0 +1,46 @@
<template>
<teleport to=".scene-designer" v-if="active">
<g @mousedown="$emit('target', {target:vd, attrs:['x1', 'y1'], delta: true})" :class="{gameObject: true, selected}">
<line :x1="vd.x1" :y1="vd.y1" :x2="parent.vd.x1" :y2="parent.vd.y1"></line>
<svg-icon :src="`/asset/thumb/${modelValue.id}.webp`" :x="vd.x1" :y="vd.y1" :size="37"></svg-icon>
</g>
</teleport>
<v-list density="compact" nav v-if="selected">
<v-list-item prepend-icon="mdi-panorama-outline" :title="$l.addScene" value="scene"></v-list-item>
</v-list>
</template>
<script>
import SvgIcon from './SvgIcon.vue';
import Utils from '@/lib/utils';
export default {
emits:['target'],
components: { SvgIcon },
data(){
return {
active: false
}
},
mounted(){
this.active = true;
},
props:{
modelValue: Object,
vd: Object,
selected: Boolean,
cid:String,
visible: Boolean,
parent: Object
},
steps: [['x1', 'y1']],
icon: 'mdi-vector-line',
name: 'svg-game-object',
modifiers: ['x1', 'y1'],
methods:{
intersect(v){
return Utils.intersectLineRect(this.vd, v);
}
}
}
</script>