icon.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <TempIcon :data="tData" :ref="(e: any) => shape = e.shape" />
  3. <PropertyUpdate
  4. :describes="describes"
  5. :data="data"
  6. :target="shape"
  7. @change="emit('updateShape', { ...data })"
  8. />
  9. <Operate :target="shape" :menus="operateMenus" />
  10. </template>
  11. <script lang="ts" setup>
  12. import TempIcon from "./temp-icon.vue";
  13. import { IconData, getMouseStyle, defaultStyle } from "./index.ts";
  14. import { useComponentStatus } from "@/core/hook/use-component.ts";
  15. import { PropertyUpdate, Operate } from "../../propertys";
  16. import { Transform } from "konva/lib/Util";
  17. const props = defineProps<{ data: IconData }>();
  18. const emit = defineEmits<{
  19. (e: "updateShape", value: IconData): void;
  20. (e: "addShape", value: IconData): void;
  21. (e: "delShape"): void;
  22. }>();
  23. const { shape, tData, data, operateMenus, describes } = useComponentStatus({
  24. emit,
  25. props,
  26. getMouseStyle,
  27. line: false,
  28. defaultStyle,
  29. copyHandler(tf, data) {
  30. data.mat = tf.multiply(new Transform(data.mat)).m;
  31. return data;
  32. },
  33. });
  34. </script>