|
@@ -0,0 +1,152 @@
|
|
|
+<template>
|
|
|
+ <ControlPanl
|
|
|
+ :group="[{ items: options }]"
|
|
|
+ v-model="selectOptions"
|
|
|
+ ref="selectExpose"
|
|
|
+ />
|
|
|
+ <ui-floating
|
|
|
+ v-if="selectOptions.some(({key}) => key === 'opacity')"
|
|
|
+ :refer="opacityOptionEl"
|
|
|
+ isTransform
|
|
|
+ dire="right-center"
|
|
|
+ >
|
|
|
+ <div class="floating-range strengthen">
|
|
|
+ <div class="range-content">
|
|
|
+ <ui-input
|
|
|
+ type="range"
|
|
|
+ v-model="a"
|
|
|
+ v-bind="modelRange.opacityRange"
|
|
|
+ :ctrl="false"
|
|
|
+ :input="false"
|
|
|
+ width="100%"
|
|
|
+ />
|
|
|
+ <span class="num" :style="{left: `${a}%`}">{{a}}%</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </ui-floating>
|
|
|
+
|
|
|
+ <div class="right-range floating-range strengthen">
|
|
|
+ <div class="range-content">
|
|
|
+ <span class="fun-ctrl" @click="a += modelRange.opacityRange.step">+</span>
|
|
|
+ <ui-input
|
|
|
+ type="range"
|
|
|
+ v-model="a"
|
|
|
+ v-bind="modelRange.opacityRange"
|
|
|
+ :moveCallback="changeRange"
|
|
|
+ :ctrl="false"
|
|
|
+ :input="false"
|
|
|
+ width="100%"
|
|
|
+ />
|
|
|
+ <span class="fun-ctrl" @click="a -= modelRange.opacityRange.step">-</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="ui-message tip-left">请在当前窗口调整水平方向位置</div>
|
|
|
+ <div class="ui-message tip-right">请在当前窗口调整垂直方向位置</div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { ref, computed, watch } from 'vue'
|
|
|
+import { ControlPanl } from '@/components/control-panl/'
|
|
|
+import { modelRange } from '@/sdk'
|
|
|
+import { diffArrayChange } from '@/utils'
|
|
|
+
|
|
|
+import type { Items, ControlExpose } from '@/components/control-panl'
|
|
|
+
|
|
|
+const options: Items = [
|
|
|
+ { desc: '移动', icon: 'move', key: 'move' },
|
|
|
+ { desc: '旋转', icon: 'flip', key: 'rotate' },
|
|
|
+ { desc: '透明度', icon: 'transparency', key: 'opacity' },
|
|
|
+]
|
|
|
+const selectOptions = ref<Items>([])
|
|
|
+const selectExpose = ref<ControlExpose>()
|
|
|
+const opacityOptionEl = computed(
|
|
|
+ () => selectExpose.value?.dom?.querySelector('div[data-key="opacity"]')
|
|
|
+)
|
|
|
+const a = ref(1)
|
|
|
+
|
|
|
+const changeRange = (sp: ScreenLocalPos, cp: ScreenLocalPos, info: { start: number, locusWidth: number }) =>
|
|
|
+ info.start + ((sp.y - cp.y) / info.locusWidth)
|
|
|
+
|
|
|
+watch(selectOptions, (nOptions, oOptions = []) => {
|
|
|
+ const { added, deleted } = diffArrayChange(nOptions, oOptions)
|
|
|
+ console.log(added, deleted)
|
|
|
+}, { immediate: true })
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.floating-range {
|
|
|
+ margin-left: 20px;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ width: 162px;
|
|
|
+ height: 32px;
|
|
|
+ background: rgba(27,27,28,0.8);
|
|
|
+ box-shadow: inset 0px 0px 0px 2px rgba(255,255,255,0.1);
|
|
|
+ border-radius: 16px;
|
|
|
+ padding: 0 10px;
|
|
|
+ .range-content {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .num {
|
|
|
+ position: absolute;
|
|
|
+ color: #fff;
|
|
|
+ bottom: 100%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ background: #000000;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 2px 6px;
|
|
|
+ font-size: 12px;
|
|
|
+ pointer-events: none;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.right-range {
|
|
|
+ position: absolute;
|
|
|
+ padding: 0;
|
|
|
+ width: 220px;
|
|
|
+ border-radius: 20px;
|
|
|
+ height: 40px;
|
|
|
+ right: 10px;
|
|
|
+ top: 50%;
|
|
|
+ z-index: 1;
|
|
|
+ transform: translateX(40%) rotate(-90deg);
|
|
|
+
|
|
|
+ .range-content {
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ span {
|
|
|
+ margin: 0 10px;
|
|
|
+ font-size: 16px;
|
|
|
+ transform: rotate(90deg);
|
|
|
+ flex: none;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.tip-left,.tip-right {
|
|
|
+ top: calc(var(--editor-head-height) + var(--header-top) + 11px);
|
|
|
+ z-index: 1;
|
|
|
+}
|
|
|
+
|
|
|
+.tip-left {
|
|
|
+ left: 25%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+}
|
|
|
+.tip-right {
|
|
|
+ left: 75%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style>
|
|
|
+.floating-range .ui-input .range .range-content {
|
|
|
+ --slideSize: calc(var(--height) + 8px) !important;
|
|
|
+}
|
|
|
+</style>
|