control.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <g>
  3. <foreignObject width="200px" height="30px" style="position: relative">
  4. <body xmlns="http://www.w3.org/1999/xhtml">
  5. <div class="control_menu">
  6. <!-- <span @click="changeModelRunningStatus">
  7. <i :class="modelRunningStatus ? 'el-icon-video-pause' : 'el-icon-video-play'"></i>
  8. </span> -->
  9. <span @click="sizeExpend">
  10. <svg class="icon" aria-hidden="true">
  11. <use xlink:href="#icon-fangda"></use>
  12. </svg>
  13. </span>
  14. <span @click="sizeShrink">
  15. <svg class="icon" aria-hidden="true">
  16. <use xlink:href="#icon-suoxiao"></use>
  17. </svg>
  18. </span>
  19. <span @click="sizeInit">
  20. <svg class="icon" aria-hidden="true">
  21. <use xlink:href="#icon-icon-test"></use>
  22. </svg>
  23. </span>
  24. <!-- <span :class="['sel_area', 'sel_area_ing'].indexOf(currentEvent) !== -1 ? 'sel_ing' : ''" @click="sel_area($event)">
  25. <svg class="icon" aria-hidden="true">
  26. <use xlink:href="#icon-duoxuankuang"></use>
  27. </svg>
  28. </span>
  29. <span @click="fullScreen">
  30. <svg class="icon" aria-hidden="true">
  31. <use xlink:href="#icon-quanping"></use>
  32. </svg>
  33. </span> -->
  34. </div>
  35. </body>
  36. </foreignObject>
  37. </g>
  38. </template>
  39. <script>
  40. import '../assets/iconfont';
  41. export default {
  42. props: {
  43. currentEvent: {
  44. type: String,
  45. default: () => {
  46. "";
  47. }
  48. },
  49. modelRunningStatus: {
  50. type: Boolean,
  51. default: () => false
  52. }
  53. },
  54. data() {
  55. return {
  56. changeScreen: "full"
  57. };
  58. },
  59. methods: {
  60. sizeExpend() {
  61. this.$emit("sizeExpend");
  62. },
  63. sizeShrink() {
  64. this.$emit("sizeShrink");
  65. },
  66. sizeInit() {
  67. this.$emit("sizeInit");
  68. },
  69. sel_area(e) {
  70. this.$emit("sel_area");
  71. e.preventDefault();
  72. e.stopPropagation();
  73. e.cancelBubble = true;
  74. },
  75. fullScreen() {
  76. if (this.changeScreen === "full") {
  77. this.changeScreen = "mini";
  78. let root = document.getElementById("svgContent");
  79. root.webkitRequestFullScreen();
  80. } else {
  81. this.changeScreen = "full";
  82. document.webkitExitFullscreen();
  83. }
  84. },
  85. changeModelRunningStatus() {
  86. this.$emit('changeModelRunningStatus', !this.modelRunningStatus)
  87. }
  88. }
  89. };
  90. </script>
  91. <style scoped>
  92. .control_menu {
  93. height: 30px;
  94. width: 200px;
  95. background: #cccccc;
  96. justify-content: space-around;
  97. display: flex;
  98. user-select: none;
  99. }
  100. .control_menu span {
  101. height: 20px;
  102. width: 20px;
  103. cursor: pointer;
  104. display: block;
  105. border-radius: 50%;
  106. text-align: center;
  107. transform: translateY(5px);
  108. }
  109. .control_menu span {
  110. transform: scale(1.4);
  111. transform-origin: 50% 0;
  112. }
  113. .sel_ing {
  114. color: #289de9;
  115. border: 1px solid #289de9 !important;
  116. border-radius: 100%;
  117. }
  118. .icon {
  119. /* 通过设置 font-size 来改变图标大小 */
  120. width: 1em; height: 1em;
  121. /* 图标和文字相邻时,垂直对齐 */
  122. vertical-align: -0.15em;
  123. /* 通过设置 color 来改变 SVG 的颜色/fill */
  124. fill: currentColor;
  125. /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
  126. normalize.css 中也包含这行 */
  127. overflow: hidden;
  128. }
  129. </style>