提交 33468cf3 authored 作者: wangjiahao's avatar wangjiahao

feat:增加画布鼠标悬停虚线边框

上级 eaa4cf9a
<template> <template>
<div class="shape" :class="{ active }" @click="selectCurComponent" @mousedown="handleMouseDownOnShape"> <div class="shape" :class="classInfo" @mouseenter="enter" @mouseleave="leave" @click="selectCurComponent" @mousedown="handleMouseDownOnShape">
<span v-show="isActive()" class="iconfont icon-xiangyouxuanzhuan" @mousedown="handleRotate" /> <span v-show="isActive()" class="iconfont icon-xiangyouxuanzhuan" @mousedown="handleRotate" />
<span v-show="element.isLock" class="iconfont icon-suo" /> <span v-show="element.isLock" class="iconfont icon-suo" />
<div <div
...@@ -26,6 +26,10 @@ export default { ...@@ -26,6 +26,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
mouseon: {
type: Boolean,
default: false
},
element: { element: {
require: true, require: true,
type: Object type: Object
...@@ -65,10 +69,22 @@ export default { ...@@ -65,10 +69,22 @@ export default {
cursors: {} cursors: {}
} }
}, },
computed: mapState([
'curComponent', computed: {
'editor' classInfo() {
]), if (this.active) {
return 'active'
} else if (this.mouseon) {
return 'mouseon'
} else {
return ''
}
},
...mapState([
'curComponent',
'editor'
])
},
mounted() { mounted() {
// 用于 Group 组件 // 用于 Group 组件
if (this.curComponent) { if (this.curComponent) {
...@@ -76,16 +92,23 @@ export default { ...@@ -76,16 +92,23 @@ export default {
} }
eventBus.$on('runAnimation', () => { eventBus.$on('runAnimation', () => {
if (this.element == this.curComponent) { if (this.element === this.curComponent) {
runAnimation(this.$el, this.curComponent.animations) runAnimation(this.$el, this.curComponent.animations)
} }
}) })
}, },
methods: { methods: {
// 鼠标移入事件
enter() {
this.mouseon = true
},
// 鼠标移出事件
leave() {
this.mouseon = false
},
isActive() { isActive() {
return this.active && !this.element.isLock return this.active && !this.element.isLock
}, },
// 处理旋转 // 处理旋转
handleRotate(e) { handleRotate(e) {
this.$store.commit('setClickComponentStatus', true) this.$store.commit('setClickComponentStatus', true)
...@@ -355,6 +378,11 @@ export default { ...@@ -355,6 +378,11 @@ export default {
outline: 1px solid #70c0ff; outline: 1px solid #70c0ff;
user-select: none; user-select: none;
} }
.mouseon {
outline: 1px dashed #70c0ff;
user-select: none;
}
.shape-point { .shape-point {
position: absolute; position: absolute;
background: #fff; background: #fff;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论