HandlePort.vue 937 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div :class="[position, type]" class="renderType flex items-center">
  3. <div :class="type" class="handlePort transition-transform duration-150 relative"></div>
  4. <div v-if="label" class="ml-8px text-12px text-#666">{{ label }}</div>
  5. </div>
  6. </template>
  7. <script setup lang="ts">
  8. defineProps<{
  9. position: string
  10. type: 'source' | 'target'
  11. label?: string
  12. }>()
  13. </script>
  14. <style lang="less" scoped>
  15. .handlePort {
  16. width: 12px;
  17. height: 12px;
  18. background-color: #fff;
  19. border: 1px solid #989898;
  20. border-radius: 50%;
  21. cursor: default;
  22. }
  23. .source:hover {
  24. transform: scale(1.2);
  25. border-width: 1.2px;
  26. cursor: crosshair;
  27. }
  28. .renderType {
  29. &.top {
  30. margin-bottom: -12px;
  31. transform: translate(0%, -50%);
  32. }
  33. &.right {
  34. margin-left: -12px;
  35. transform: translate(50%, 0%);
  36. }
  37. &.left {
  38. margin-right: -12px;
  39. transform: translate(-50%, 0%);
  40. }
  41. &.bottom {
  42. margin-top: -12px;
  43. transform: translate(0%, 50%);
  44. }
  45. }
  46. </style>