|
|
@ -1,4 +1,4 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { computed, ref } from 'vue' |
|
|
|
import { computed, ref } from 'vue' |
|
|
|
import Draggable from 'vuedraggable' |
|
|
|
import Draggable from 'vuedraggable' |
|
|
|
import { useContext } from '../context' |
|
|
|
import { useContext } from '../context' |
|
|
@ -87,36 +87,36 @@ function handleCanvasClick(e: MouseEvent): void { |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="ddd-canvas" |
|
|
|
|
|
|
|
:class="{ |
|
|
|
:class="{ |
|
|
|
'is-focused': ctx.canvas.focused, |
|
|
|
'is-focused': ctx.canvas.focused, |
|
|
|
'is-active': ctx.activeViewId === '#canvas', |
|
|
|
'is-active': ctx.activeViewId === '#canvas', |
|
|
|
'is-hover': ctx.hoverViewId === '#canvas', |
|
|
|
'is-hover': ctx.hoverViewId === '#canvas', |
|
|
|
}" |
|
|
|
}" |
|
|
|
|
|
|
|
class="ddd-canvas" |
|
|
|
> |
|
|
|
> |
|
|
|
<!-- 中间自定义内容 --> |
|
|
|
<!-- 中间自定义内容 --> |
|
|
|
<!-- @change="handleDraggingOver" --> |
|
|
|
<!-- @change="handleDraggingOver" --> |
|
|
|
<Draggable |
|
|
|
<Draggable |
|
|
|
:key="key" |
|
|
|
|
|
|
|
v-model="ctx.blocks" |
|
|
|
v-model="ctx.blocks" |
|
|
|
class="ddd-canvas-viewer" |
|
|
|
:key="key" |
|
|
|
:animation="200" |
|
|
|
:animation="200" |
|
|
|
:disabled="false" |
|
|
|
|
|
|
|
:component-data="{ |
|
|
|
:component-data="{ |
|
|
|
tag: 'div', |
|
|
|
tag: 'div', |
|
|
|
type: 'transition-group', |
|
|
|
type: 'transition-group', |
|
|
|
}" |
|
|
|
}" |
|
|
|
|
|
|
|
:disabled="false" |
|
|
|
:group="{ |
|
|
|
:group="{ |
|
|
|
name: 'emulator', |
|
|
|
name: 'emulator', |
|
|
|
put: 'modules', |
|
|
|
put: 'modules', |
|
|
|
}" |
|
|
|
}" |
|
|
|
|
|
|
|
class="ddd-canvas-viewer" |
|
|
|
ghost-class="is-ghost" |
|
|
|
ghost-class="is-ghost" |
|
|
|
item-key="id" |
|
|
|
item-key="id" |
|
|
|
@click="handleCanvasClick" |
|
|
|
|
|
|
|
@start="handleDragStart" |
|
|
|
|
|
|
|
@end="handleDragEnd" |
|
|
|
|
|
|
|
@add="handleDragAdd" |
|
|
|
@add="handleDragAdd" |
|
|
|
@change="key++" |
|
|
|
@change="key++" |
|
|
|
|
|
|
|
@click="handleCanvasClick" |
|
|
|
|
|
|
|
@end="handleDragEnd" |
|
|
|
|
|
|
|
@start="handleDragStart" |
|
|
|
> |
|
|
|
> |
|
|
|
<template #header> |
|
|
|
<template #header> |
|
|
|
<div v-show="ctx.page.safeAreaInsetTop && !ctx.page.fullscreen" class="ddd-canvas-safe-area-inset-top" /> |
|
|
|
<div v-show="ctx.page.safeAreaInsetTop && !ctx.page.fullscreen" class="ddd-canvas-safe-area-inset-top" /> |
|
|
@ -129,7 +129,7 @@ function handleCanvasClick(e: MouseEvent): void { |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<template #item="{ element }"> |
|
|
|
<template #item="{ element }"> |
|
|
|
<RenderBlock class="ddd-view" :block="element" /> |
|
|
|
<RenderBlock :block="element" class="ddd-view" /> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</Draggable> |
|
|
|
</Draggable> |
|
|
|
|
|
|
|
|
|
|
@ -137,13 +137,13 @@ function handleCanvasClick(e: MouseEvent): void { |
|
|
|
<DddView |
|
|
|
<DddView |
|
|
|
v-show="ctx.page.header.enabled" |
|
|
|
v-show="ctx.page.header.enabled" |
|
|
|
vid="#header" |
|
|
|
vid="#header" |
|
|
|
class="ddd-canvas-header" |
|
|
|
|
|
|
|
:class="{ 'is-bordered': ctx.page.header.bordered ?? true }" |
|
|
|
:class="{ 'is-bordered': ctx.page.header.bordered ?? true }" |
|
|
|
|
|
|
|
class="ddd-canvas-header" |
|
|
|
> |
|
|
|
> |
|
|
|
<div v-show="ctx.page.safeAreaInsetTop && !ctx.page.fullscreen" class="ddd-canvas-safe-area-inset-top" /> |
|
|
|
<div v-show="ctx.page.safeAreaInsetTop && !ctx.page.fullscreen" class="ddd-canvas-safe-area-inset-top" /> |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="ddd-canvas-header-title" |
|
|
|
|
|
|
|
:style="{ textAlign: ctx.page.header.centerTitle ? 'center' : undefined }" |
|
|
|
:style="{ textAlign: ctx.page.header.centerTitle ? 'center' : undefined }" |
|
|
|
|
|
|
|
class="ddd-canvas-header-title" |
|
|
|
v-text="ctx.page.header.title" |
|
|
|
v-text="ctx.page.header.title" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</DddView> |
|
|
|
</DddView> |
|
|
@ -162,12 +162,12 @@ function handleCanvasClick(e: MouseEvent): void { |
|
|
|
<!-- 顶部状态栏、小程序胶囊按钮、底部操作指示器 --> |
|
|
|
<!-- 顶部状态栏、小程序胶囊按钮、底部操作指示器 --> |
|
|
|
<template v-if="!ctx.page.fullscreen"> |
|
|
|
<template v-if="!ctx.page.fullscreen"> |
|
|
|
<div class="ddd-canvas-statusbar"> |
|
|
|
<div class="ddd-canvas-statusbar"> |
|
|
|
<img style="height:20px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXcAAAAUCAYAAAB2132+AAAAAXNSR0IArs4c6QAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAABd6ADAAQAAAABAAAAFAAAAABeOGisAAAGY0lEQVR4Ae2ZCWwVVRSGX6VaRItogShW8xCsilZwQ8QqQRQjilaLEhG1uEWIS9QgrmlFUYILwaIxRuKCCrhgVcANbIjGqMiSWGrSsFTEJSgYLUtww+9v58ab6fS9tjxbXt75k6/33jMz9837e++ZM20sZjIHzAFzwB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ux4omZvMgXRzIIcbPh8KUnzjtcy3EHameF6bzhwwB8wBc8AcMAfMAXPAHDAHzAFzwBwwB8wBc8AcMAfMAXPAHDAHIhz4FwO/QgbhZ4FRAAAAAElFTkSuQmCC" style="height:20px"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="ctx.target === 'routine'" class="ddd-canvas-routine-button"> |
|
|
|
<div v-if="ctx.target === 'routine'" class="ddd-canvas-routine-button"> |
|
|
|
<svg width="87" height="32" viewBox="0 0 87 32" xmlns="http://www.w3.org/2000/svg"> |
|
|
|
<svg height="32" viewBox="0 0 87 32" width="87" xmlns="http://www.w3.org/2000/svg"> |
|
|
|
<rect width="87" height="32" rx="16" x="0" y="0" fill="rgba(0,0,0,0.3)" /> |
|
|
|
<rect fill="rgba(0,0,0,0.3)" height="32" rx="16" width="87" x="0" y="0" /> |
|
|
|
<rect id="rect5" width="0.5" height="18.5" fill="rgba(255,255,255,0.6)" x="43.5" y="6.5" /> |
|
|
|
<rect id="rect5" fill="rgba(255,255,255,0.6)" height="18.5" width="0.5" x="43.5" y="6.5" /> |
|
|
|
<path d="M 19.5,16.25 A 3.25,3.25 0 1 1 22.75,19.5 3.25,3.25 0 0 1 19.5,16.25 Z M 28,16.5 a 2,2 0 1 1 2,2 2,2 0 0 1 -2,-2 z m -14.5,0 a 2,2 0 1 1 2,2 2,2 0 0 1 -2,-2 z" fill="#ffffff" /> |
|
|
|
<path d="M 19.5,16.25 A 3.25,3.25 0 1 1 22.75,19.5 3.25,3.25 0 0 1 19.5,16.25 Z M 28,16.5 a 2,2 0 1 1 2,2 2,2 0 0 1 -2,-2 z m -14.5,0 a 2,2 0 1 1 2,2 2,2 0 0 1 -2,-2 z" fill="#ffffff" /> |
|
|
|
<path d="m 59.187,21.813 a 8.716,8.716 0 0 1 -2.52,-6.222 8,8 0 0 1 2.52,-5.8 8.915,8.915 0 0 1 6.223,-2.458 8.288,8.288 0 0 1 5.8,2.459 8.18,8.18 0 0 1 2.457,5.799 8.918,8.918 0 0 1 -2.46,6.223 8,8 0 0 1 -5.797,2.519 8.714,8.714 0 0 1 -6.223,-2.52 z m -0.52,-5.739 a 6.521,6.521 0 0 0 6.741,6.259 6.423,6.423 0 0 0 6.259,-6.259 6.521,6.521 0 0 0 -6.259,-6.741 6.593,6.593 0 0 0 -6.741,6.741 z m 3.5,-0.241 a 3,3 0 1 1 3,3 3,3 0 0 1 -3,-3 z" fill="#ffffff" /> |
|
|
|
<path d="m 59.187,21.813 a 8.716,8.716 0 0 1 -2.52,-6.222 8,8 0 0 1 2.52,-5.8 8.915,8.915 0 0 1 6.223,-2.458 8.288,8.288 0 0 1 5.8,2.459 8.18,8.18 0 0 1 2.457,5.799 8.918,8.918 0 0 1 -2.46,6.223 8,8 0 0 1 -5.797,2.519 8.714,8.714 0 0 1 -6.223,-2.52 z m -0.52,-5.739 a 6.521,6.521 0 0 0 6.741,6.259 6.423,6.423 0 0 0 6.259,-6.259 6.521,6.521 0 0 0 -6.259,-6.741 6.593,6.593 0 0 0 -6.741,6.741 z m 3.5,-0.241 a 3,3 0 1 1 3,3 3,3 0 0 1 -3,-3 z" fill="#ffffff" /> |
|
|
|
</svg> |
|
|
|
</svg> |
|
|
@ -177,7 +177,7 @@ function handleCanvasClick(e: MouseEvent): void { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less"> |
|
|
|
<style lang="less" scoped> |
|
|
|
.ddd-canvas { |
|
|
|
.ddd-canvas { |
|
|
|
--canvas-measure-line: v-bind(measureLine); |
|
|
|
--canvas-measure-line: v-bind(measureLine); |
|
|
|
|
|
|
|
|
|
|
|