bg-image.vue 1.0 KB

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