triangle.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <TempLine
  3. :data="tData"
  4. :ref="(v: any) => shape = v?.shape"
  5. :id="data.id"
  6. editer
  7. @update-content="updateContent"
  8. />
  9. <PropertyUpdate
  10. :describes="describes"
  11. :data="data"
  12. :target="shape"
  13. @delete="emit('delShape')"
  14. @change="emit('updateShape', { ...data })"
  15. />
  16. <Operate :target="shape" :menus="operateMenus" />
  17. </template>
  18. <script lang="ts" setup>
  19. import { TriangleData, getMouseStyle, defaultStyle, matResponse } from "./index.ts";
  20. import { PropertyUpdate, Operate } from "../../html-mount/propertys/index.ts";
  21. import TempLine from "./temp-triangle.vue";
  22. import { useComponentStatus } from "@/core/hook/use-component.ts";
  23. const props = defineProps<{ data: TriangleData }>();
  24. const emit = defineEmits<{
  25. (e: "updateShape", value: TriangleData): void;
  26. (e: "addShape", value: TriangleData): void;
  27. (e: "delShape"): void;
  28. }>();
  29. const updateContent = (val: string) => {
  30. data.value.content = val;
  31. emit("updateShape", { ...data.value });
  32. };
  33. const { shape, tData, operateMenus, describes, data } = useComponentStatus({
  34. emit,
  35. props,
  36. getMouseStyle,
  37. defaultStyle,
  38. transformType: "line",
  39. alignment(data, mat) {
  40. return matResponse({ mat, data, increment: true });
  41. },
  42. copyHandler(mat, data) {
  43. return matResponse({ mat, data, increment: true });
  44. },
  45. propertys: [
  46. "fill",
  47. "stroke",
  48. "fontColor",
  49. "strokeWidth",
  50. "fontSize",
  51. // "ref",
  52. "opacity",
  53. // "dash",
  54. // "zIndex"
  55. "align",
  56. "fontStyle",
  57. // "ref", "zIndex"
  58. ],
  59. });
  60. </script>