<template>
  <div :style="{ width: props.dimensions.width * props.ratioWidth + 'px', height: props.dimensions.height * props.ratioHeight + 'px' }">
    <NodeResizer color="#000" v-if="!props.isView && !props.isHideHandle && props.selected" />

    <div
      class="custom-node"
      :style="{
        width: props.dimensions.width * props.ratioWidth + 'px',
        height: props.dimensions.height * props.ratioHeight + 'px',
        pointerEvents: props.isView ? 'auto' : 'none'
      }"
    >
      <el-image style="width: 100%; height: 100%" :src="props.data.customData.type === 1 ? img1 : img2" fit="contain" />
    </div>
  </div>
</template>
<script setup>
import img1 from '@/assets/electronicComponents/1.png';
import img2 from '@/assets/electronicComponents/2.png';
import { defineEmits, defineProps, ref } from 'vue';
import { NodeResizer } from '@vue-flow/node-resizer';
import { Handle, Position } from '@vue-flow/core';

const props = defineProps({
  ratioWidth: {
    type: Number,
    required: false,
    default: 1
  },
  ratioHeight: {
    type: Number,
    required: false,
    default: 1
  },
  isView: {
    type: Boolean,
    required: false
  },
  inputData: {
    type: Object,
    required: false
  },
  id: {
    type: String,
    required: true
  },
  isHideHandle: {
    type: Boolean,
    required: false
  },
  selected: {
    type: Boolean,
    required: false
  },
  data: {
    type: Object,
    required: true
  },
  dimensions: {
    type: Object,
    required: true
  }
});
onMounted(() => {
  console.log(props);
});
</script>
<style scoped>
.custom-node {
  width: 100%;
  height: 100%;
}
</style>
