forked from github/dataease
refactor:仪表板设置有间隙时,视图移动触发按钮和边界线靠近视图排列
This commit is contained in:
parent
133ae7c70b
commit
d3ed5ca66b
@ -3,14 +3,12 @@
|
|||||||
:style="style"
|
:style="style"
|
||||||
:class="[
|
:class="[
|
||||||
{
|
{
|
||||||
[classNameActive]: enabled ,
|
|
||||||
[classNameDragging]: dragging,
|
[classNameDragging]: dragging,
|
||||||
[classNameResizing]: resizing,
|
[classNameResizing]: resizing,
|
||||||
[classNameDraggable]: draggable,
|
[classNameDraggable]: draggable,
|
||||||
[classNameResizable]: resizable,
|
[classNameResizable]: resizable,
|
||||||
[classNameRotating]: rotating,
|
[classNameRotating]: rotating,
|
||||||
[classNameRotatable]: rotatable,
|
[classNameRotatable]: rotatable,
|
||||||
[classNameMouseOn]: mouseOn || active,
|
|
||||||
['linkageSetting']:linkageActive,
|
['linkageSetting']:linkageActive,
|
||||||
['positionChange']:!(dragging || resizing||rotating)
|
['positionChange']:!(dragging || resizing||rotating)
|
||||||
},
|
},
|
||||||
@ -21,19 +19,28 @@
|
|||||||
@mouseenter="enter"
|
@mouseenter="enter"
|
||||||
@mouseleave="leave"
|
@mouseleave="leave"
|
||||||
>
|
>
|
||||||
<edit-bar v-if="curComponent&&(active||linkageSettingStatus)" style="transform: translateZ(10px)" :active-model="'edit'" :element="element" @showViewDetails="showViewDetails" @amRemoveItem="amRemoveItem" @amAddItem="amAddItem" @resizeView="resizeView" @linkJumpSet="linkJumpSet" />
|
|
||||||
<div v-if="resizing" style="transform: translateZ(11px);position: absolute; z-index: 3" :style="resizeShadowStyle" />
|
|
||||||
<div
|
<div
|
||||||
v-for="(handlei, indexi) in actualHandles"
|
:class="[
|
||||||
:key="indexi"
|
{
|
||||||
:class="[classNameHandle, classNameHandle + '-' + handlei]"
|
[classNameActive]: enabled ,
|
||||||
:style="handleStyle(handlei, indexi)"
|
[classNameMouseOn]: mouseOn || active
|
||||||
@mousedown.stop.prevent="handleDown(handlei, $event)"
|
},
|
||||||
@touchstart.stop.prevent="handleTouchDown(handlei, $event)"
|
className
|
||||||
|
]"
|
||||||
|
:style="mainSlotStyle"
|
||||||
>
|
>
|
||||||
<slot :name="handlei" />
|
<edit-bar v-if="curComponent&&(active||linkageSettingStatus)" style="transform: translateZ(10px)" :active-model="'edit'" :element="element" @showViewDetails="showViewDetails" @amRemoveItem="amRemoveItem" @amAddItem="amAddItem" @resizeView="resizeView" @linkJumpSet="linkJumpSet" />
|
||||||
</div>
|
<div v-if="resizing" style="transform: translateZ(11px);position: absolute; z-index: 3" :style="resizeShadowStyle" />
|
||||||
<div :style="mainSlotStyle" :class="{'gap_class':canvasStyleData.panel.gap==='yes'}">
|
<div
|
||||||
|
v-for="(handlei, indexi) in actualHandles"
|
||||||
|
:key="indexi"
|
||||||
|
:class="[classNameHandle, classNameHandle + '-' + handlei]"
|
||||||
|
:style="handleStyle(handlei, indexi)"
|
||||||
|
@mousedown.stop.prevent="handleDown(handlei, $event)"
|
||||||
|
@touchstart.stop.prevent="handleTouchDown(handlei, $event)"
|
||||||
|
>
|
||||||
|
<slot :name="handlei" />
|
||||||
|
</div>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -437,6 +444,7 @@ export default {
|
|||||||
style() {
|
style() {
|
||||||
// console.log('style-top:' + this.y + '--' + this.top)
|
// console.log('style-top:' + this.y + '--' + this.top)
|
||||||
return {
|
return {
|
||||||
|
padding: (this.canvasStyleData.panel.gap === 'yes' ? this.componentGap : 0) + 'px',
|
||||||
transform: `translate(${this.left}px, ${this.top}px) rotate(${this.rotate}deg)`,
|
transform: `translate(${this.left}px, ${this.top}px) rotate(${this.rotate}deg)`,
|
||||||
width: this.computedWidth,
|
width: this.computedWidth,
|
||||||
height: this.computedHeight,
|
height: this.computedHeight,
|
||||||
@ -479,6 +487,7 @@ export default {
|
|||||||
|
|
||||||
// 根据left right 算出元素的宽度
|
// 根据left right 算出元素的宽度
|
||||||
computedMainSlotWidth() {
|
computedMainSlotWidth() {
|
||||||
|
const gap = (this.canvasStyleData.panel.gap === 'yes' ? this.componentGap : 0) * 2
|
||||||
if (this.w === 'auto') {
|
if (this.w === 'auto') {
|
||||||
if (!this.widthTouched) {
|
if (!this.widthTouched) {
|
||||||
return 'auto'
|
return 'auto'
|
||||||
@ -486,13 +495,14 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.element.auxiliaryMatrix) {
|
if (this.element.auxiliaryMatrix) {
|
||||||
const width = Math.round(this.width / this.curCanvasScale.matrixStyleWidth) * this.curCanvasScale.matrixStyleWidth
|
const width = Math.round(this.width / this.curCanvasScale.matrixStyleWidth) * this.curCanvasScale.matrixStyleWidth
|
||||||
return width + 'px'
|
return (width - gap) + 'px'
|
||||||
} else {
|
} else {
|
||||||
return this.width + 'px'
|
return (this.width - gap) + 'px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 根据top bottom 算出元素的宽度
|
// 根据top bottom 算出元素的宽度
|
||||||
computedMainSlotHeight() {
|
computedMainSlotHeight() {
|
||||||
|
const gap = (this.canvasStyleData.panel.gap === 'yes' ? this.componentGap : 0) * 2
|
||||||
if (this.h === 'auto') {
|
if (this.h === 'auto') {
|
||||||
if (!this.heightTouched) {
|
if (!this.heightTouched) {
|
||||||
return 'auto'
|
return 'auto'
|
||||||
@ -500,9 +510,9 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.element.auxiliaryMatrix) {
|
if (this.element.auxiliaryMatrix) {
|
||||||
const height = Math.round(this.height / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight
|
const height = Math.round(this.height / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight
|
||||||
return height + 'px'
|
return (height - gap) + 'px'
|
||||||
} else {
|
} else {
|
||||||
return this.height + 'px'
|
return (this.height - gap) + 'px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -522,7 +532,8 @@ export default {
|
|||||||
'editor',
|
'editor',
|
||||||
'curCanvasScale',
|
'curCanvasScale',
|
||||||
'canvasStyleData',
|
'canvasStyleData',
|
||||||
'linkageSettingStatus'
|
'linkageSettingStatus',
|
||||||
|
'componentGap'
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -1792,6 +1803,11 @@ export default {
|
|||||||
padding:5px;
|
padding:5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.de-drag-active{
|
||||||
|
outline: 1px solid #70c0ff;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
/*.mouseOn >>> .icon-shezhi{*/
|
/*.mouseOn >>> .icon-shezhi{*/
|
||||||
/* z-index: 2;*/
|
/* z-index: 2;*/
|
||||||
/* display:block!important;*/
|
/* display:block!important;*/
|
||||||
|
Loading…
Reference in New Issue
Block a user