Skip to content

Commit

Permalink
fix: 完善元素层级设置方法
Browse files Browse the repository at this point in the history
  • Loading branch information
wangrongding committed Apr 8, 2024
1 parent 23b7fc4 commit d4f3b8a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/components/player/CanvasPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,26 @@ function resizePlayer() {
function setElementLayer(type: 'up' | 'down') {
const activeObject = canvas.getActiveObject()
if (!activeObject) return
if (type === 'up') {
// 上移一层
canvas.bringForward(activeObject)
} else {
// 下移一层
canvas.sendBackwards(activeObject)
switch (type) {
case 'up':
// 上移一层
canvas.bringForward(activeObject)
break
case 'down':
// 下移一层
canvas.sendBackwards(activeObject)
break
case 'top':
// 置于顶层
canvas.bringToFront(activeObject)
break
case 'bottom':
// 置于底层
canvas.sendToBack(activeObject)
break
default:
break
}
canvas.discardActiveObject()
menuShow.value = false
}
Expand Down

0 comments on commit d4f3b8a

Please sign in to comment.