优化线条的鼠标操作范围

This commit is contained in:
pipipi-pikachu 2021-01-30 10:53:48 +08:00
parent 081a092db4
commit df23eb6870

View File

@ -6,11 +6,9 @@
top: elementInfo.top + 'px', top: elementInfo.top + 'px',
left: elementInfo.left + 'px', left: elementInfo.left + 'px',
}" }"
@mousedown="$event => handleSelectElement($event)"
> >
<div <div
class="element-content" class="element-content"
v-contextmenu="contextmenus"
:style="{ filter: shadowStyle ? `drop-shadow(${shadowStyle})` : '' }" :style="{ filter: shadowStyle ? `drop-shadow(${shadowStyle})` : '' }"
> >
<SvgWrapper <SvgWrapper
@ -47,6 +45,15 @@
stroke-miterlimit stroke-miterlimit
:marker-start="elementInfo.points[0] ? `url(#${elementInfo.id}-${elementInfo.points[0]}-start)` : ''" :marker-start="elementInfo.points[0] ? `url(#${elementInfo.id}-${elementInfo.points[0]}-start)` : ''"
:marker-end="elementInfo.points[1] ? `url(#${elementInfo.id}-${elementInfo.points[1]}-end)` : ''" :marker-end="elementInfo.points[1] ? `url(#${elementInfo.id}-${elementInfo.points[1]}-end)` : ''"
></path>
<path
class="line-path"
:d="path"
stroke="transparent"
stroke-width="20"
fill="none"
@mousedown="$event => handleSelectElement($event)"
v-contextmenu="contextmenus"
></path> ></path>
</SvgWrapper> </SvgWrapper>
</div> </div>
@ -121,9 +128,8 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.editable-element-shape { .editable-element-shape {
position: absolute; position: absolute;
cursor: move;
&.lock .element-content { &.lock .line-path {
cursor: default; cursor: default;
} }
} }
@ -138,4 +144,7 @@ export default defineComponent({
overflow: visible; overflow: visible;
} }
} }
.line-path {
cursor: move;
}
</style> </style>