6
0

annotation-box.vue 737 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <div class="annotation-box" :style="style">
  3. .annotation-box
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "annotation-box",
  9. props: ['image', 'position'],
  10. computed: {
  11. style: function() {
  12. const left = this.image.left;
  13. const top = this.image.top;
  14. const width = this.image.width;
  15. const height = this.image.height;
  16. return {
  17. left: (left + this.position.x * width) + 'px',
  18. top: (top + this.position.y * height) + 'px',
  19. width: (this.position.w * width) + 'px',
  20. height: (this.position.h * height) + 'px',
  21. }
  22. }
  23. }
  24. }
  25. </script>
  26. <style scoped>
  27. .annotation-box {
  28. position: absolute;
  29. background-color: rgba(255, 255, 255, 0.3);
  30. }
  31. </style>