HandlePort.vue 960 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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="w-max 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. flex-shrink: 0;
  23. }
  24. .source:hover {
  25. transform: scale(1.2);
  26. border-width: 1.2px;
  27. cursor: crosshair;
  28. }
  29. .renderType {
  30. &.top {
  31. margin-bottom: -16px;
  32. transform: translate(0%, -50%);
  33. }
  34. &.right {
  35. margin-left: -16px;
  36. transform: translate(50%, 0%);
  37. }
  38. &.left {
  39. margin-right: -16px;
  40. transform: translate(-50%, 0%);
  41. }
  42. &.bottom {
  43. margin-top: -16px;
  44. transform: translate(0%, 50%);
  45. }
  46. }
  47. </style>