zhengyiming
12 小时以前 97f29024ce18babeb4b635c5d73f907ac493976e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!--
 * @Author: 秦少卫
 * @Date: 2022-09-03 19:16:55
 * @LastEditors: 秦少卫
 * @LastEditTime: 2024-10-13 17:14:52
 * @Description: 元素翻转
-->
 
<template>
  <div v-if="isOne" class="attr-item-box">
    <!-- <h3>{{ $t('attrSeting.flip.name') }}</h3> -->
    <!-- <Divider plain orientation="left">
      <h4>{{ $t('attrSeting.flip.name') }}</h4>
    </Divider> -->
    <div class="bg-item">
      <Tooltip :content="$t('attrSeting.flip.x')">
        <Button long @click="flip('X')" type="text">
          <flipX width="14" height="14"></flipX>
        </Button>
      </Tooltip>
      <Tooltip :content="$t('attrSeting.flip.y')">
        <Button long @click="flip('Y')" type="text">
          <flipY width="14" height="14"></flipY>
        </Button>
      </Tooltip>
    </div>
 
    <!-- <Divider plain></Divider> -->
  </div>
</template>
 
<script setup name="Flip">
import useSelect from '@/hooks/select';
import flipX from '@/assets/icon/flip/x.svg';
import flipY from '@/assets/icon/flip/y.svg';
 
const { isOne, canvasEditor } = useSelect();
 
const flip = (type) => {
  const activeObject = canvasEditor.canvas.getActiveObject();
  activeObject.set(`flip${type}`, !activeObject[`flip${type}`]).setCoords();
  canvasEditor.canvas.requestRenderAll();
};
</script>
 
<style scoped lang="less">
:deep(.ivu-btn) {
  &[disabled] {
    svg {
      opacity: 0.2;
    }
  }
}
 
.attr-item-box {
  margin-top: 8px;
}
</style>