<template>
  <v-path :config="config" name="icon-path" />

  <v-path :config="props.config" name="icon-path" />
</template>

<script lang="ts" setup>
import { parseSvgContent } from "@/utils/resource";
import { Transform } from "konva/lib/Util";
import { computed } from "vue";

const props = defineProps<{
  config: ReturnType<typeof parseSvgContent>["paths"][0];
  mat: Transform;
}>();

const config = computed(() => {
  if (!props.config.fix) {
    return props.config;
  }
  // return props.config;
  const inv = props.mat.copy().invert();
  const invDec = inv.decompose();
  const config = {
    ...props.config,
    ...invDec,
    x: 0,
    y: 0,
  };
  return config;
});
</script>
