Skip to content

Commit

Permalink
feat: 图层中增加锁定状态图标的显示
Browse files Browse the repository at this point in the history
feat: 图层中增加锁定状态图标的显示
  • Loading branch information
Qiu-Jun committed Jul 16, 2024
2 parents 9761788 + 24815e4 commit ef47142
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/components/layer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@
:key="item.id"
:class="isSelect(item) && 'active'"
>
<Tooltip :content="item.name || item.text || item.type" placement="left">
<div class="ellipsis">
<span :class="isSelect(item) && 'active'" v-html="iconType(item.type)"></span>
| {{ textType(item.type, item) }}
</div>
</Tooltip>
<Row class="ellipsis">
<Col span="20">
<Tooltip :content="item.name || item.text || item.type" placement="left">
<span :class="isSelect(item) && 'active'" v-html="iconType(item.type)"></span>
| {{ textType(item.type, item) }}
</Tooltip>
</Col>
<Col span="4">
<Button
long
:icon="item.isLock ? 'md-lock' : 'md-unlock'"
type="text"
@click="doLock(item)"
></Button>
</Col>
</Row>
</div>
</div>
<!-- 层级调整按钮 -->
Expand Down Expand Up @@ -135,17 +145,24 @@ const getList = () => {
]
.reverse()
.map((item) => {
const { type, id, name, text } = item;
const { type, id, name, text, selectable } = item;
return {
type,
id,
name,
text,
isLock: !selectable,
};
});
list.value = uniqBy(unref(list), 'id');
};
const doLock = (item) => {
select(item.id);
item.isLock ? canvasEditor.unLock() : canvasEditor.lock();
canvasEditor.canvas.discardActiveObject();
};
onMounted(() => {
getList();
canvasEditor.canvas.on('after:render', getList);
Expand Down

0 comments on commit ef47142

Please sign in to comment.