bhd-components 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/{100c4e1e.esm.es5.development.js → a5565b8a.esm.es5.development.js} +9674 -2548
  2. package/dist/deb6cc9b.esm.es5.production.js +485 -0
  3. package/dist/index.esm.es5.development.css +379 -0
  4. package/dist/index.esm.es5.development.js +3871 -6326
  5. package/dist/index.esm.es5.production.css +1 -1
  6. package/dist/index.esm.es5.production.js +1 -1
  7. package/es2017/customerService/index.js +1 -1
  8. package/es2017/customerService/js-screen-shot/assets/less/screen-shot.less +478 -0
  9. package/es2017/customerService/js-screen-shot/lib/common-methods/CanvasPatch.d.ts +1 -0
  10. package/es2017/customerService/js-screen-shot/lib/common-methods/CanvasPatch.js +15 -0
  11. package/es2017/customerService/js-screen-shot/lib/common-methods/DeviceTypeVerif.d.ts +2 -0
  12. package/es2017/customerService/js-screen-shot/lib/common-methods/DeviceTypeVerif.js +32 -0
  13. package/es2017/customerService/js-screen-shot/lib/common-methods/FixedData.d.ts +11 -0
  14. package/es2017/customerService/js-screen-shot/lib/common-methods/FixedData.js +17 -0
  15. package/es2017/customerService/js-screen-shot/lib/common-methods/GetBrushSelectedName.d.ts +5 -0
  16. package/es2017/customerService/js-screen-shot/lib/common-methods/GetBrushSelectedName.js +18 -0
  17. package/es2017/customerService/js-screen-shot/lib/common-methods/GetCanvasImgData.d.ts +4 -0
  18. package/es2017/customerService/js-screen-shot/lib/common-methods/GetCanvasImgData.js +25 -0
  19. package/es2017/customerService/js-screen-shot/lib/common-methods/GetColor.d.ts +1 -0
  20. package/es2017/customerService/js-screen-shot/lib/common-methods/GetColor.js +41 -0
  21. package/es2017/customerService/js-screen-shot/lib/common-methods/GetSelectedCalssName.d.ts +1 -0
  22. package/es2017/customerService/js-screen-shot/lib/common-methods/GetSelectedCalssName.js +23 -0
  23. package/es2017/customerService/js-screen-shot/lib/common-methods/GetToolRelativePosition.d.ts +7 -0
  24. package/es2017/customerService/js-screen-shot/lib/common-methods/GetToolRelativePosition.js +9 -0
  25. package/es2017/customerService/js-screen-shot/lib/common-methods/ImgScaling.d.ts +11 -0
  26. package/es2017/customerService/js-screen-shot/lib/common-methods/ImgScaling.js +41 -0
  27. package/es2017/customerService/js-screen-shot/lib/common-methods/SaveBorderArrInfo.d.ts +8 -0
  28. package/es2017/customerService/js-screen-shot/lib/common-methods/SaveBorderArrInfo.js +125 -0
  29. package/es2017/customerService/js-screen-shot/lib/common-methods/SaveCanvasToBase64.d.ts +1 -0
  30. package/es2017/customerService/js-screen-shot/lib/common-methods/SaveCanvasToBase64.js +37 -0
  31. package/es2017/customerService/js-screen-shot/lib/common-methods/SaveCanvasToImage.d.ts +1 -0
  32. package/es2017/customerService/js-screen-shot/lib/common-methods/SaveCanvasToImage.js +26 -0
  33. package/es2017/customerService/js-screen-shot/lib/common-methods/SelectColor.d.ts +1 -0
  34. package/es2017/customerService/js-screen-shot/lib/common-methods/SelectColor.js +6 -0
  35. package/es2017/customerService/js-screen-shot/lib/common-methods/SelectTextSize.d.ts +5 -0
  36. package/es2017/customerService/js-screen-shot/lib/common-methods/SelectTextSize.js +26 -0
  37. package/es2017/customerService/js-screen-shot/lib/common-methods/SetBrushSize.d.ts +14 -0
  38. package/es2017/customerService/js-screen-shot/lib/common-methods/SetBrushSize.js +50 -0
  39. package/es2017/customerService/js-screen-shot/lib/common-methods/SetSelectedClassName.d.ts +7 -0
  40. package/es2017/customerService/js-screen-shot/lib/common-methods/SetSelectedClassName.js +28 -0
  41. package/es2017/customerService/js-screen-shot/lib/common-methods/TakeOutHistory.d.ts +1 -0
  42. package/es2017/customerService/js-screen-shot/lib/common-methods/TakeOutHistory.js +20 -0
  43. package/es2017/customerService/js-screen-shot/lib/common-methods/UpdateContainerMouseStyle.d.ts +1 -0
  44. package/es2017/customerService/js-screen-shot/lib/common-methods/UpdateContainerMouseStyle.js +10 -0
  45. package/es2017/customerService/js-screen-shot/lib/common-methods/ZoomCutOutBoxPosition.d.ts +17 -0
  46. package/es2017/customerService/js-screen-shot/lib/common-methods/ZoomCutOutBoxPosition.js +92 -0
  47. package/es2017/customerService/js-screen-shot/lib/config/Toolbar.d.ts +5 -0
  48. package/es2017/customerService/js-screen-shot/lib/config/Toolbar.js +46 -0
  49. package/es2017/customerService/js-screen-shot/lib/main-entrance/CreateDom.d.ts +24 -0
  50. package/es2017/customerService/js-screen-shot/lib/main-entrance/CreateDom.js +304 -0
  51. package/es2017/customerService/js-screen-shot/lib/main-entrance/InitData.d.ts +78 -0
  52. package/es2017/customerService/js-screen-shot/lib/main-entrance/InitData.js +538 -0
  53. package/es2017/customerService/js-screen-shot/lib/main-entrance/PlugInParameters.d.ts +46 -0
  54. package/es2017/customerService/js-screen-shot/lib/main-entrance/PlugInParameters.js +162 -0
  55. package/es2017/customerService/js-screen-shot/lib/split-methods/AddHistoryData.d.ts +1 -0
  56. package/es2017/customerService/js-screen-shot/lib/split-methods/AddHistoryData.js +23 -0
  57. package/es2017/customerService/js-screen-shot/lib/split-methods/BoundaryJudgment.d.ts +8 -0
  58. package/es2017/customerService/js-screen-shot/lib/split-methods/BoundaryJudgment.js +13 -0
  59. package/es2017/customerService/js-screen-shot/lib/split-methods/CalculateOptionIcoPosition.d.ts +5 -0
  60. package/es2017/customerService/js-screen-shot/lib/split-methods/CalculateOptionIcoPosition.js +21 -0
  61. package/es2017/customerService/js-screen-shot/lib/split-methods/CalculateToolLocation.d.ts +16 -0
  62. package/es2017/customerService/js-screen-shot/lib/split-methods/CalculateToolLocation.js +39 -0
  63. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawArrow.d.ts +31 -0
  64. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawArrow.js +131 -0
  65. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawCircle.d.ts +11 -0
  66. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawCircle.js +37 -0
  67. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawCutOutBox.d.ts +19 -0
  68. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawCutOutBox.js +118 -0
  69. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawLineArrow.d.ts +13 -0
  70. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawLineArrow.js +51 -0
  71. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawMasking.d.ts +6 -0
  72. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawMasking.js +41 -0
  73. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawMosaic.d.ts +12 -0
  74. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawMosaic.js +67 -0
  75. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawPencil.d.ts +13 -0
  76. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawPencil.js +27 -0
  77. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawRectangle.d.ts +11 -0
  78. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawRectangle.js +22 -0
  79. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawText.d.ts +10 -0
  80. package/es2017/customerService/js-screen-shot/lib/split-methods/DrawText.js +24 -0
  81. package/es2017/customerService/js-screen-shot/lib/split-methods/KeyboardEventHandle.d.ts +10 -0
  82. package/es2017/customerService/js-screen-shot/lib/split-methods/KeyboardEventHandle.js +50 -0
  83. package/es2017/customerService/js-screen-shot/lib/split-methods/SetPlugInParameters.d.ts +2 -0
  84. package/es2017/customerService/js-screen-shot/lib/split-methods/SetPlugInParameters.js +61 -0
  85. package/es2017/customerService/js-screen-shot/lib/split-methods/ToolClickEvent.d.ts +1 -0
  86. package/es2017/customerService/js-screen-shot/lib/split-methods/ToolClickEvent.js +132 -0
  87. package/es2017/customerService/js-screen-shot/lib/split-methods/drawCrossImg.d.ts +1 -0
  88. package/es2017/customerService/js-screen-shot/lib/split-methods/drawCrossImg.js +32 -0
  89. package/es2017/customerService/js-screen-shot/lib/type/ComponentType.d.ts +133 -0
  90. package/es2017/customerService/js-screen-shot/lib/type/ComponentType.js +2 -0
  91. package/es2017/customerService/js-screen-shot/main.d.ts +110 -0
  92. package/es2017/customerService/js-screen-shot/main.js +1098 -0
  93. package/esm/customerService/index.js +1 -1
  94. package/esm/customerService/js-screen-shot/assets/less/screen-shot.less +478 -0
  95. package/esm/customerService/js-screen-shot/lib/common-methods/CanvasPatch.d.ts +1 -0
  96. package/esm/customerService/js-screen-shot/lib/common-methods/CanvasPatch.js +15 -0
  97. package/esm/customerService/js-screen-shot/lib/common-methods/DeviceTypeVerif.d.ts +2 -0
  98. package/esm/customerService/js-screen-shot/lib/common-methods/DeviceTypeVerif.js +32 -0
  99. package/esm/customerService/js-screen-shot/lib/common-methods/FixedData.d.ts +11 -0
  100. package/esm/customerService/js-screen-shot/lib/common-methods/FixedData.js +17 -0
  101. package/esm/customerService/js-screen-shot/lib/common-methods/GetBrushSelectedName.d.ts +5 -0
  102. package/esm/customerService/js-screen-shot/lib/common-methods/GetBrushSelectedName.js +18 -0
  103. package/esm/customerService/js-screen-shot/lib/common-methods/GetCanvasImgData.d.ts +4 -0
  104. package/esm/customerService/js-screen-shot/lib/common-methods/GetCanvasImgData.js +25 -0
  105. package/esm/customerService/js-screen-shot/lib/common-methods/GetColor.d.ts +1 -0
  106. package/esm/customerService/js-screen-shot/lib/common-methods/GetColor.js +41 -0
  107. package/esm/customerService/js-screen-shot/lib/common-methods/GetSelectedCalssName.d.ts +1 -0
  108. package/esm/customerService/js-screen-shot/lib/common-methods/GetSelectedCalssName.js +23 -0
  109. package/esm/customerService/js-screen-shot/lib/common-methods/GetToolRelativePosition.d.ts +7 -0
  110. package/esm/customerService/js-screen-shot/lib/common-methods/GetToolRelativePosition.js +10 -0
  111. package/esm/customerService/js-screen-shot/lib/common-methods/ImgScaling.d.ts +11 -0
  112. package/esm/customerService/js-screen-shot/lib/common-methods/ImgScaling.js +38 -0
  113. package/esm/customerService/js-screen-shot/lib/common-methods/SaveBorderArrInfo.d.ts +8 -0
  114. package/esm/customerService/js-screen-shot/lib/common-methods/SaveBorderArrInfo.js +125 -0
  115. package/esm/customerService/js-screen-shot/lib/common-methods/SaveCanvasToBase64.d.ts +1 -0
  116. package/esm/customerService/js-screen-shot/lib/common-methods/SaveCanvasToBase64.js +37 -0
  117. package/esm/customerService/js-screen-shot/lib/common-methods/SaveCanvasToImage.d.ts +1 -0
  118. package/esm/customerService/js-screen-shot/lib/common-methods/SaveCanvasToImage.js +26 -0
  119. package/esm/customerService/js-screen-shot/lib/common-methods/SelectColor.d.ts +1 -0
  120. package/esm/customerService/js-screen-shot/lib/common-methods/SelectColor.js +6 -0
  121. package/esm/customerService/js-screen-shot/lib/common-methods/SelectTextSize.d.ts +5 -0
  122. package/esm/customerService/js-screen-shot/lib/common-methods/SelectTextSize.js +26 -0
  123. package/esm/customerService/js-screen-shot/lib/common-methods/SetBrushSize.d.ts +14 -0
  124. package/esm/customerService/js-screen-shot/lib/common-methods/SetBrushSize.js +50 -0
  125. package/esm/customerService/js-screen-shot/lib/common-methods/SetSelectedClassName.d.ts +7 -0
  126. package/esm/customerService/js-screen-shot/lib/common-methods/SetSelectedClassName.js +28 -0
  127. package/esm/customerService/js-screen-shot/lib/common-methods/TakeOutHistory.d.ts +1 -0
  128. package/esm/customerService/js-screen-shot/lib/common-methods/TakeOutHistory.js +20 -0
  129. package/esm/customerService/js-screen-shot/lib/common-methods/UpdateContainerMouseStyle.d.ts +1 -0
  130. package/esm/customerService/js-screen-shot/lib/common-methods/UpdateContainerMouseStyle.js +10 -0
  131. package/esm/customerService/js-screen-shot/lib/common-methods/ZoomCutOutBoxPosition.d.ts +17 -0
  132. package/esm/customerService/js-screen-shot/lib/common-methods/ZoomCutOutBoxPosition.js +92 -0
  133. package/esm/customerService/js-screen-shot/lib/config/Toolbar.d.ts +5 -0
  134. package/esm/customerService/js-screen-shot/lib/config/Toolbar.js +46 -0
  135. package/esm/customerService/js-screen-shot/lib/main-entrance/CreateDom.d.ts +24 -0
  136. package/esm/customerService/js-screen-shot/lib/main-entrance/CreateDom.js +345 -0
  137. package/esm/customerService/js-screen-shot/lib/main-entrance/InitData.d.ts +78 -0
  138. package/esm/customerService/js-screen-shot/lib/main-entrance/InitData.js +758 -0
  139. package/esm/customerService/js-screen-shot/lib/main-entrance/PlugInParameters.d.ts +46 -0
  140. package/esm/customerService/js-screen-shot/lib/main-entrance/PlugInParameters.js +259 -0
  141. package/esm/customerService/js-screen-shot/lib/split-methods/AddHistoryData.d.ts +1 -0
  142. package/esm/customerService/js-screen-shot/lib/split-methods/AddHistoryData.js +23 -0
  143. package/esm/customerService/js-screen-shot/lib/split-methods/BoundaryJudgment.d.ts +8 -0
  144. package/esm/customerService/js-screen-shot/lib/split-methods/BoundaryJudgment.js +13 -0
  145. package/esm/customerService/js-screen-shot/lib/split-methods/CalculateOptionIcoPosition.d.ts +5 -0
  146. package/esm/customerService/js-screen-shot/lib/split-methods/CalculateOptionIcoPosition.js +21 -0
  147. package/esm/customerService/js-screen-shot/lib/split-methods/CalculateToolLocation.d.ts +16 -0
  148. package/esm/customerService/js-screen-shot/lib/split-methods/CalculateToolLocation.js +39 -0
  149. package/esm/customerService/js-screen-shot/lib/split-methods/DrawArrow.d.ts +31 -0
  150. package/esm/customerService/js-screen-shot/lib/split-methods/DrawArrow.js +159 -0
  151. package/esm/customerService/js-screen-shot/lib/split-methods/DrawCircle.d.ts +11 -0
  152. package/esm/customerService/js-screen-shot/lib/split-methods/DrawCircle.js +37 -0
  153. package/esm/customerService/js-screen-shot/lib/split-methods/DrawCutOutBox.d.ts +19 -0
  154. package/esm/customerService/js-screen-shot/lib/split-methods/DrawCutOutBox.js +119 -0
  155. package/esm/customerService/js-screen-shot/lib/split-methods/DrawLineArrow.d.ts +13 -0
  156. package/esm/customerService/js-screen-shot/lib/split-methods/DrawLineArrow.js +51 -0
  157. package/esm/customerService/js-screen-shot/lib/split-methods/DrawMasking.d.ts +6 -0
  158. package/esm/customerService/js-screen-shot/lib/split-methods/DrawMasking.js +41 -0
  159. package/esm/customerService/js-screen-shot/lib/split-methods/DrawMosaic.d.ts +12 -0
  160. package/esm/customerService/js-screen-shot/lib/split-methods/DrawMosaic.js +67 -0
  161. package/esm/customerService/js-screen-shot/lib/split-methods/DrawPencil.d.ts +13 -0
  162. package/esm/customerService/js-screen-shot/lib/split-methods/DrawPencil.js +27 -0
  163. package/esm/customerService/js-screen-shot/lib/split-methods/DrawRectangle.d.ts +11 -0
  164. package/esm/customerService/js-screen-shot/lib/split-methods/DrawRectangle.js +22 -0
  165. package/esm/customerService/js-screen-shot/lib/split-methods/DrawText.d.ts +10 -0
  166. package/esm/customerService/js-screen-shot/lib/split-methods/DrawText.js +24 -0
  167. package/esm/customerService/js-screen-shot/lib/split-methods/KeyboardEventHandle.d.ts +10 -0
  168. package/esm/customerService/js-screen-shot/lib/split-methods/KeyboardEventHandle.js +61 -0
  169. package/esm/customerService/js-screen-shot/lib/split-methods/SetPlugInParameters.d.ts +2 -0
  170. package/esm/customerService/js-screen-shot/lib/split-methods/SetPlugInParameters.js +62 -0
  171. package/esm/customerService/js-screen-shot/lib/split-methods/ToolClickEvent.d.ts +1 -0
  172. package/esm/customerService/js-screen-shot/lib/split-methods/ToolClickEvent.js +132 -0
  173. package/esm/customerService/js-screen-shot/lib/split-methods/drawCrossImg.d.ts +1 -0
  174. package/esm/customerService/js-screen-shot/lib/split-methods/drawCrossImg.js +32 -0
  175. package/esm/customerService/js-screen-shot/lib/type/ComponentType.d.ts +133 -0
  176. package/esm/customerService/js-screen-shot/lib/type/ComponentType.js +2 -0
  177. package/esm/customerService/js-screen-shot/main.d.ts +110 -0
  178. package/esm/customerService/js-screen-shot/main.js +1201 -0
  179. package/package.json +1 -1
  180. package/dist/a4d5ce04.esm.es5.production.js +0 -468
@@ -0,0 +1,1098 @@
1
+ import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
+ import CreateDom from "./lib/main-entrance/CreateDom";
4
+ // 导入截图所需样式
5
+ import "./assets/less/screen-shot.less";
6
+ import InitData from "./lib/main-entrance/InitData";
7
+ import { drawMasking } from "./lib/split-methods/DrawMasking";
8
+ import { fixedData, nonNegativeData } from "./lib/common-methods/FixedData";
9
+ import { drawPencil, initPencil } from "./lib/split-methods/DrawPencil";
10
+ import { drawText } from "./lib/split-methods/DrawText";
11
+ import { drawRectangle } from "./lib/split-methods/DrawRectangle";
12
+ import { drawCircle } from "./lib/split-methods/DrawCircle";
13
+ import { DrawArrow } from "./lib/split-methods/DrawArrow";
14
+ import { drawMosaic } from "./lib/split-methods/DrawMosaic";
15
+ import { drawCutOutBox } from "./lib/split-methods/DrawCutOutBox";
16
+ import { zoomCutOutBoxPosition } from "./lib/common-methods/ZoomCutOutBoxPosition";
17
+ import { saveBorderArrInfo } from "./lib/common-methods/SaveBorderArrInfo";
18
+ import { calculateToolLocation } from "./lib/split-methods/CalculateToolLocation";
19
+ import html2canvas from "html2canvas";
20
+ import PlugInParameters from "./lib/main-entrance/PlugInParameters";
21
+ import { getDrawBoundaryStatus } from "./lib/split-methods/BoundaryJudgment";
22
+ import KeyboardEventHandle from "./lib/split-methods/KeyboardEventHandle";
23
+ import { setPlugInParameters } from "./lib/split-methods/SetPlugInParameters";
24
+ import { drawCrossImg } from "./lib/split-methods/drawCrossImg";
25
+ import { getCanvas2dCtx } from "./lib/common-methods/CanvasPatch";
26
+ import { updateContainerMouseStyle } from "./lib/common-methods/UpdateContainerMouseStyle";
27
+ import { addHistory } from "./lib/split-methods/AddHistoryData";
28
+ import { isPC, isTouchDevice } from "./lib/common-methods/DeviceTypeVerif";
29
+ import { drawLineArrow } from "./lib/split-methods/DrawLineArrow";
30
+ class ScreenShot {
31
+ // 获取截图区域canvas容器
32
+ getCanvasController() {
33
+ return this.screenShotContainer;
34
+ }
35
+ // 销毁组件方法
36
+ destroyComponents() {
37
+ this.data.destroyDOM();
38
+ this.data.setInitStatus(true);
39
+ }
40
+ // 确认截图方法
41
+ completeScreenshot() {
42
+ if (this.keyboardEventHandle) {
43
+ this.keyboardEventHandle.triggerEvent("confirm");
44
+ }
45
+ }
46
+ // 注册右键事件
47
+ registerForRightClickEvent(container) {
48
+ container.addEventListener("contextmenu", (e)=>{
49
+ e.preventDefault();
50
+ // 调用者传入了自定义事件则执行
51
+ if (this.customRightClickEvent.handleFn) {
52
+ this.customRightClickEvent.handleFn();
53
+ return;
54
+ }
55
+ // 销毁组件
56
+ this.destroyComponents();
57
+ });
58
+ }
59
+ // 加载截图组件
60
+ load(triggerCallback, cancelCallback) {
61
+ const canvasSize = this.plugInParameters.getCanvasSize();
62
+ const viewSize = {
63
+ width: parseFloat(window.getComputedStyle(document.body).width),
64
+ height: parseFloat(window.getComputedStyle(document.body).height)
65
+ };
66
+ // 设置截图区域canvas宽高
67
+ this.data.setScreenShotInfo(viewSize.width, viewSize.height);
68
+ // 设置截图容器位置
69
+ this.data.setScreenShotPosition(this.position.left, this.position.top);
70
+ // 设置截图图片存放容器宽高
71
+ this.screenShotImageController.width = viewSize.width;
72
+ this.screenShotImageController.height = viewSize.height;
73
+ // 用户有传宽高则使用用户传进来的
74
+ if (canvasSize.canvasWidth !== 0 && canvasSize.canvasHeight !== 0) {
75
+ this.data.setScreenShotInfo(canvasSize.canvasWidth, canvasSize.canvasHeight);
76
+ this.screenShotImageController.width = canvasSize.canvasWidth;
77
+ this.screenShotImageController.height = canvasSize.canvasHeight;
78
+ }
79
+ // 获取截图区域canvas容器画布
80
+ if (this.screenShotContainer == null) return;
81
+ const context = getCanvas2dCtx(this.screenShotContainer, this.screenShotImageController.width, this.screenShotImageController.height);
82
+ if (context == null) return;
83
+ // 显示截图区域容器
84
+ this.data.showScreenShotPanel();
85
+ if (!this.plugInParameters.getWebRtcStatus()) {
86
+ // 判断用户是否自己传入截屏图片
87
+ if (this.imgSrc != null) {
88
+ this.drawPictures(triggerCallback, context, this.imgSrc);
89
+ return;
90
+ }
91
+ // html2canvas截屏
92
+ html2canvas(this.screenShotDom ? this.screenShotDom : document.body, {
93
+ onclone: this.loadCrossImg ? drawCrossImg : undefined,
94
+ proxy: this.proxyUrl,
95
+ useCORS: this.useCORS
96
+ }).then((canvas)=>{
97
+ // 装载截图的dom为null则退出
98
+ if (this.screenShotContainer == null) return;
99
+ // 存储html2canvas截取的内容
100
+ this.screenShotImageController = canvas;
101
+ // 初始化截图容器
102
+ this.initScreenShot(triggerCallback, context, canvas);
103
+ }).catch((err)=>{
104
+ if (triggerCallback != null) {
105
+ // 获取页面元素成功,执行回调函数
106
+ triggerCallback({
107
+ code: -1,
108
+ msg: err
109
+ });
110
+ }
111
+ });
112
+ return;
113
+ }
114
+ // 调用者有传入屏幕流数据则使用
115
+ if (this.plugInParameters.getScreenFlow()) {
116
+ this.sendStream(this.plugInParameters.getScreenFlow(), cancelCallback, triggerCallback);
117
+ return;
118
+ }
119
+ // 隐藏光标
120
+ document.body.classList.add("no-cursor");
121
+ // 使用webrtc实现截屏
122
+ this.screenShot(cancelCallback, triggerCallback);
123
+ }
124
+ loadScreenFlowData(triggerCallback) {
125
+ setTimeout(()=>{
126
+ var _this_screenShotImageController, _this_screenShotImageController1;
127
+ // 获取截图区域canvas容器画布
128
+ if (this.screenShotContainer == null) return;
129
+ const canvasSize = this.plugInParameters.getCanvasSize();
130
+ let containerWidth = (_this_screenShotImageController = this.screenShotImageController) === null || _this_screenShotImageController === void 0 ? void 0 : _this_screenShotImageController.width;
131
+ let containerHeight = (_this_screenShotImageController1 = this.screenShotImageController) === null || _this_screenShotImageController1 === void 0 ? void 0 : _this_screenShotImageController1.height;
132
+ // 用户有传宽高时,则使用用户的
133
+ if (canvasSize.canvasWidth !== 0 && canvasSize.canvasHeight !== 0) {
134
+ containerWidth = canvasSize.canvasWidth;
135
+ containerHeight = canvasSize.canvasHeight;
136
+ }
137
+ let imgContainerWidth = containerWidth;
138
+ let imgContainerHeight = containerHeight;
139
+ if (this.wrcWindowMode) {
140
+ imgContainerWidth = containerWidth * this.dpr;
141
+ imgContainerHeight = containerHeight * this.dpr;
142
+ }
143
+ const context = getCanvas2dCtx(this.screenShotContainer, containerWidth, containerHeight);
144
+ const imgContext = getCanvas2dCtx(this.screenShotImageController, imgContainerWidth, imgContainerHeight);
145
+ if (context == null || imgContext == null) return;
146
+ // 赋值截图区域canvas画布
147
+ this.screenShotCanvas = context;
148
+ const { videoWidth , videoHeight } = this.videoController;
149
+ if (this.wrcWindowMode) {
150
+ // 从窗口视频流中获取body内容
151
+ const bodyImgData = this.getWindowContentData(videoWidth, videoHeight, containerWidth * this.dpr, containerHeight * this.dpr);
152
+ if (bodyImgData == null) return;
153
+ // 将body内容绘制到图片容器里
154
+ imgContext.putImageData(bodyImgData, 0, 0);
155
+ } else {
156
+ // 对webrtc源提供的图像宽高进行修复
157
+ let fixWidth = containerWidth;
158
+ let fixHeight = videoHeight * containerWidth / videoWidth;
159
+ if (fixHeight > containerHeight) {
160
+ fixWidth = containerWidth * containerHeight / fixHeight;
161
+ fixHeight = containerHeight;
162
+ }
163
+ // 对视频容器的内容进行裁剪
164
+ fixWidth = this.wrcImgPosition.w > 0 ? this.wrcImgPosition.w : fixWidth;
165
+ fixHeight = this.wrcImgPosition.h > 0 ? this.wrcImgPosition.h : fixHeight;
166
+ // console.log("对视频容器的内容进行裁剪", {
167
+ // wrcImgPosition: this.wrcImgPosition,
168
+ // containerWidth,
169
+ // containerHeight,
170
+ // videoWidth,
171
+ // videoHeight,
172
+ // fixWidth,
173
+ // fixHeight
174
+ // });
175
+ imgContext === null || imgContext === void 0 ? void 0 : imgContext.drawImage(this.videoController, this.wrcImgPosition.x, this.wrcImgPosition.y, fixWidth, fixHeight);
176
+ // // 要保存的字符串
177
+ // const stringData = imgContext.canvas.toDataURL("png");
178
+ // // dada 表示要转换的字符串数据,type 表示要转换的数据格式
179
+ // const blob = new Blob([stringData], {
180
+ // type: "text/plain;charset=utf-8"
181
+ // });
182
+ // // 根据 blob生成 url链接
183
+ // const objectURL = URL.createObjectURL(blob);
184
+ // // 创建一个 a 标签Tag
185
+ // const aTag = document.createElement("a");
186
+ // // 设置文件的下载地址
187
+ // aTag.href = objectURL;
188
+ // // 设置保存后的文件名称
189
+ // aTag.download = `${new Date().getTime()}.txt`;
190
+ // // 给 a 标签添加点击事件
191
+ // aTag.click();
192
+ // // 释放一个之前已经存在的、通过调用 URL.createObjectURL() 创建的 URL 对象。
193
+ // // 当你结束使用某个 URL 对象之后,应该通过调用这个方法来让浏览器知道不用在内存中继续保留对这个文件的引用了。
194
+ // URL.revokeObjectURL(objectURL);
195
+ // 隐藏滚动条会出现部分内容未截取到,需要进行修复
196
+ const diffHeight = containerHeight - fixHeight;
197
+ if (this.hiddenScrollBar.state && diffHeight > 0 && this.hiddenScrollBar.fillState) {
198
+ console.log("填充容器的剩余部分");
199
+ // 填充容器的剩余部分
200
+ imgContext.beginPath();
201
+ let fillWidth = containerWidth;
202
+ let fillHeight = diffHeight;
203
+ if (this.hiddenScrollBar.fillWidth > 0) {
204
+ fillWidth = this.hiddenScrollBar.fillWidth;
205
+ }
206
+ if (this.hiddenScrollBar.fillHeight > 0) {
207
+ fillHeight = this.hiddenScrollBar.fillHeight;
208
+ }
209
+ imgContext.rect(0, fixHeight, fillWidth, fillHeight);
210
+ imgContext.fillStyle = this.hiddenScrollBar.color;
211
+ imgContext.fill();
212
+ }
213
+ }
214
+ // 初始化截图容器
215
+ this.initScreenShot(undefined, context, this.screenShotImageController);
216
+ let displaySurface = null;
217
+ let displayLabel = null;
218
+ if (this.captureStream) {
219
+ var _this_captureStream_getVideoTracks__getSettings;
220
+ // 获取当前选择的窗口类型
221
+ displaySurface = (_this_captureStream_getVideoTracks__getSettings = this.captureStream.getVideoTracks()[0].getSettings()) === null || _this_captureStream_getVideoTracks__getSettings === void 0 ? void 0 : _this_captureStream_getVideoTracks__getSettings.displaySurface;
222
+ // 获取当前选择的标签页标识
223
+ displayLabel = this.captureStream.getVideoTracks()[0].label;
224
+ }
225
+ // 执行截图成功回调
226
+ if (triggerCallback) {
227
+ triggerCallback({
228
+ code: 0,
229
+ msg: "截图加载完成",
230
+ displaySurface,
231
+ displayLabel
232
+ });
233
+ }
234
+ // 停止捕捉屏幕
235
+ this.stopCapture();
236
+ // 重置光标状态
237
+ document.body.classList.remove("no-cursor");
238
+ }, this.wrcReplyTime);
239
+ }
240
+ // 调整插件容器层级
241
+ adjustContainerLevels(level) {
242
+ if (this.screenShotContainer == null || this.toolController == null || this.textInputController == null || this.optionIcoController == null || this.optionController == null || // this.cutBoxSizeContainer == null ||
243
+ level <= 0) {
244
+ return;
245
+ }
246
+ this.screenShotContainer.style.zIndex = `${level}`;
247
+ this.toolController.style.zIndex = `${level + 1}`;
248
+ this.textInputController.style.zIndex = `${level + 1}`;
249
+ this.optionIcoController.style.zIndex = `${level + 1}`;
250
+ this.optionController.style.zIndex = `${level + 1}`;
251
+ // this.cutBoxSizeContainer.style.zIndex = `${level + 1}`;
252
+ }
253
+ // 初始化裁剪框
254
+ initCropBox(cropBoxInfo) {
255
+ const startX = cropBoxInfo.x;
256
+ const startY = cropBoxInfo.y;
257
+ const width = cropBoxInfo.w;
258
+ const height = cropBoxInfo.h;
259
+ if (this.screenShotContainer == null) return;
260
+ this.drawGraphPosition = {
261
+ startX,
262
+ startY,
263
+ width,
264
+ height
265
+ };
266
+ this.data.setCutOutBoxPosition(startX, startY, width, height);
267
+ drawCutOutBox(startX, startY, width, height, this.screenShotCanvas, this.data.getBorderSize(), this.screenShotContainer, this.screenShotImageController);
268
+ // 保存边框节点信息
269
+ this.cutOutBoxBorderArr = saveBorderArrInfo(this.data.getBorderSize(), this.drawGraphPosition);
270
+ // 修改鼠标状态为拖动
271
+ this.screenShotContainer.style.cursor = "move";
272
+ // 显示截图工具栏
273
+ // this.data.setToolStatus(true);
274
+ // // 显示裁剪框尺寸显示容器
275
+ // this.data.setCutBoxSizeStatus(true);
276
+ if (this.toolController != null) {
277
+ // 渲染截图工具栏
278
+ this.showToolBar();
279
+ }
280
+ }
281
+ /**
282
+ * 从窗口数据流中截取页面body内容
283
+ * @param videoWidth 窗口宽度
284
+ * @param videoHeight 窗口高度
285
+ * @param containerWidth body内容宽度
286
+ * @param containerHeight body内容高度
287
+ * @private
288
+ */ getWindowContentData(videoWidth, videoHeight, containerWidth, containerHeight) {
289
+ const videoCanvas = document.createElement("canvas");
290
+ videoCanvas.width = videoWidth;
291
+ videoCanvas.height = videoHeight;
292
+ const videoContext = getCanvas2dCtx(videoCanvas, videoWidth, videoHeight);
293
+ if (videoContext) {
294
+ videoContext.drawImage(this.videoController, 0, 0);
295
+ const startX = 0;
296
+ const startY = videoHeight - containerHeight;
297
+ const width = containerWidth;
298
+ const height = videoHeight - startY;
299
+ // 获取裁剪框区域图片信息;
300
+ return videoContext.getImageData(startX * this.dpr, startY * this.dpr, width * this.dpr, height * this.dpr);
301
+ }
302
+ return null;
303
+ }
304
+ // 为指定容器绑定快捷键
305
+ registerContainerShortcuts(container) {
306
+ container.addEventListener("keydown", (event)=>{
307
+ if (this.screenShotCanvas == null) return;
308
+ // command/ctrl + enter 将输入框的文字绘制到画布内
309
+ // 按下ESC时如果有内容则绘制
310
+ if ((event.metaKey || event.ctrlKey) && event.code === "Enter" || event.code === "Escape") {
311
+ this.data.setTextEditState(true);
312
+ const text = container.innerText;
313
+ if (!text || text === "") {
314
+ // 隐藏输入框
315
+ this.data.setTextStatus(false);
316
+ return;
317
+ }
318
+ drawText(text, this.textInputPosition.mouseX, this.textInputPosition.mouseY, this.data.getSelectedColor(), this.data.getFontSize(), this.screenShotCanvas);
319
+ // 清空文本输入区域的内容
320
+ container.innerHTML = "";
321
+ // 隐藏输入框
322
+ this.data.setTextStatus(false);
323
+ // 保存绘制记录
324
+ addHistory();
325
+ }
326
+ });
327
+ }
328
+ showToolBar() {
329
+ if (this.toolController == null || this.screenShotContainer == null) return;
330
+ // 计算截图工具栏位置
331
+ const toolLocation = calculateToolLocation(this.drawGraphPosition, this.toolController.offsetWidth, this.screenShotContainer.width / this.dpr, this.placement, this.position);
332
+ const containerHeight = this.screenShotContainer.height / this.dpr;
333
+ // 工具栏的位置超出截图容器时,调整工具栏位置防止超出
334
+ if (toolLocation.mouseY > containerHeight - 64) {
335
+ toolLocation.mouseY -= this.drawGraphPosition.height + 64;
336
+ // 超出屏幕顶部时
337
+ if (toolLocation.mouseY < 0) {
338
+ const containerHeight = parseInt(this.screenShotContainer.style.height);
339
+ toolLocation.mouseY = containerHeight - this.fullScreenDiffHeight;
340
+ }
341
+ // 设置工具栏超出状态为true
342
+ this.data.setToolPositionStatus(true);
343
+ // // 隐藏裁剪框尺寸显示容器
344
+ // this.data.setCutBoxSizeStatus(false);
345
+ }
346
+ // 当前截取的是全屏,则修改工具栏的位置到截图容器最底部,防止超出
347
+ if (this.getFullScreenStatus) {
348
+ const containerHeight = parseInt(this.screenShotContainer.style.height);
349
+ // 重新计算工具栏的x轴位置
350
+ const toolPositionX = (this.drawGraphPosition.width / this.dpr - this.toolController.offsetWidth) / 2;
351
+ toolLocation.mouseY = containerHeight - this.fullScreenDiffHeight;
352
+ toolLocation.mouseX = toolPositionX;
353
+ }
354
+ // 显示并设置截图工具栏位置
355
+ this.data.setToolInfo(toolLocation.mouseX + this.position.left, toolLocation.mouseY + this.position.top);
356
+ // // 设置裁剪框尺寸显示容器位置
357
+ // this.data.setCutBoxSizePosition(
358
+ // this.drawGraphPosition.startX,
359
+ // this.drawGraphPosition.startY - 35
360
+ // );
361
+ // // 渲染裁剪框尺寸
362
+ // this.data.setCutBoxSize(
363
+ // this.drawGraphPosition.width,
364
+ // this.drawGraphPosition.height
365
+ // );
366
+ // 状态重置
367
+ this.getFullScreenStatus = false;
368
+ }
369
+ setGlobalParameter() {
370
+ this.screenShotContainer = this.data.getScreenShotContainer();
371
+ this.toolController = this.data.getToolController();
372
+ this.textInputController = this.data.getTextInputController();
373
+ this.optionController = this.data.getOptionController();
374
+ this.optionIcoController = this.data.getOptionIcoController();
375
+ // this.cutBoxSizeContainer = this.data.getCutBoxSizeContainer() as HTMLDivElement | null;
376
+ }
377
+ setOptionalParameter(options) {
378
+ // 单击截取全屏启用状态,默认为false
379
+ if ((options === null || options === void 0 ? void 0 : options.clickCutFullScreen) === true) {
380
+ this.clickCutFullScreen = true;
381
+ }
382
+ // 判断调用者是否传了截图进来
383
+ if ((options === null || options === void 0 ? void 0 : options.imgSrc) != null) {
384
+ this.imgSrc = options.imgSrc;
385
+ }
386
+ // 是否加载跨域图片
387
+ if ((options === null || options === void 0 ? void 0 : options.loadCrossImg) === true) {
388
+ this.loadCrossImg = true;
389
+ }
390
+ // 跨域时的代理服务器地址
391
+ if (options === null || options === void 0 ? void 0 : options.proxyUrl) {
392
+ this.proxyUrl = options.proxyUrl;
393
+ }
394
+ if (options === null || options === void 0 ? void 0 : options.useCORS) {
395
+ this.useCORS = options.useCORS;
396
+ }
397
+ // 设置截图容器的位置信息
398
+ if ((options === null || options === void 0 ? void 0 : options.position) != null) {
399
+ var _options_position, _options_position1;
400
+ if (((_options_position = options.position) === null || _options_position === void 0 ? void 0 : _options_position.top) != null) {
401
+ this.position.top = options.position.top;
402
+ }
403
+ if (((_options_position1 = options.position) === null || _options_position1 === void 0 ? void 0 : _options_position1.left) != null) {
404
+ this.position.left = options.position.left;
405
+ }
406
+ }
407
+ // 截图容器dom
408
+ if (options === null || options === void 0 ? void 0 : options.screenShotDom) {
409
+ this.screenShotDom = options.screenShotDom;
410
+ }
411
+ // webrtc截图等待时间
412
+ if (options === null || options === void 0 ? void 0 : options.wrcReplyTime) {
413
+ this.wrcReplyTime = options.wrcReplyTime;
414
+ }
415
+ // 是否初始化裁剪框
416
+ if (options === null || options === void 0 ? void 0 : options.cropBoxInfo) {
417
+ this.cropBoxInfo = options.cropBoxInfo;
418
+ }
419
+ // 是否需要更改工具栏的展示位置
420
+ if (options === null || options === void 0 ? void 0 : options.toolPosition) {
421
+ this.placement = options.toolPosition;
422
+ }
423
+ // 是否需要对webrtc模式下捕获到的内容进行裁剪
424
+ if (options === null || options === void 0 ? void 0 : options.wrcImgPosition) {
425
+ const { x , y } = options.wrcImgPosition;
426
+ // 坐标需要取负数才能正确的裁剪
427
+ this.wrcImgPosition.x = Math.abs(x) * -1;
428
+ this.wrcImgPosition.y = Math.abs(y) * -1;
429
+ }
430
+ // 是否隐藏滚动条
431
+ if ((options === null || options === void 0 ? void 0 : options.hiddenScrollBar) != null) {
432
+ const { state , color , fillWidth , fillHeight , fillState } = options.hiddenScrollBar;
433
+ this.hiddenScrollBar = {
434
+ state,
435
+ color: color ? color : "#000000",
436
+ fillWidth: fillWidth ? fillWidth : 0,
437
+ fillHeight: fillHeight ? fillHeight : 0,
438
+ fillState: fillState ? fillState : false
439
+ };
440
+ if (state) {
441
+ this.data.setResetScrollbarState(true);
442
+ // 设置页面宽高并隐藏滚动条
443
+ document.documentElement.classList.add("hidden-screen-shot-scroll");
444
+ document.body.classList.add("hidden-screen-shot-scroll");
445
+ }
446
+ }
447
+ // 是否启用窗口截图模式
448
+ if ((options === null || options === void 0 ? void 0 : options.wrcWindowMode) != null) {
449
+ this.wrcWindowMode = options.wrcWindowMode;
450
+ }
451
+ if ((options === null || options === void 0 ? void 0 : options.curTabState) != null) {
452
+ this.curTabState = options.curTabState;
453
+ }
454
+ if ((options === null || options === void 0 ? void 0 : options.customRightClickEvent) != null) {
455
+ this.customRightClickEvent = options.customRightClickEvent;
456
+ }
457
+ }
458
+ /**
459
+ * 操作裁剪框
460
+ * @param currentX 裁剪框当前x轴坐标
461
+ * @param currentY 裁剪框当前y轴坐标
462
+ * @param startX 鼠标x轴坐标
463
+ * @param startY 鼠标y轴坐标
464
+ * @param width 裁剪框宽度
465
+ * @param height 裁剪框高度
466
+ * @param context 需要进行绘制的canvas画布
467
+ * @private
468
+ */ operatingCutOutBox(currentX, currentY, startX, startY, width, height, context) {
469
+ // canvas元素不存在
470
+ if (this.screenShotContainer == null) {
471
+ return;
472
+ }
473
+ // 获取鼠标按下时的坐标
474
+ const { moveStartX , moveStartY } = this.movePosition;
475
+ // 裁剪框边框节点事件存在且裁剪框未进行操作,则对鼠标样式进行修改
476
+ if (this.cutOutBoxBorderArr.length > 0 && !this.data.getDraggingTrim()) {
477
+ // 标识鼠标是否在裁剪框内
478
+ let flag = false;
479
+ // 判断鼠标位置
480
+ context.beginPath();
481
+ for(let i = 0; i < this.cutOutBoxBorderArr.length; i++){
482
+ context.rect(this.cutOutBoxBorderArr[i].x, this.cutOutBoxBorderArr[i].y, this.cutOutBoxBorderArr[i].width, this.cutOutBoxBorderArr[i].height);
483
+ // 当前坐标点处于8个可操作点上,修改鼠标指针样式
484
+ if (context.isPointInPath(currentX * this.dpr, currentY * this.dpr)) {
485
+ switch(this.cutOutBoxBorderArr[i].index){
486
+ case 1:
487
+ if (this.data.getToolClickStatus()) {
488
+ // 修改截图容器内的鼠标样式
489
+ updateContainerMouseStyle(this.screenShotContainer, this.data.getActiveToolName());
490
+ } else {
491
+ this.screenShotContainer.style.cursor = "move";
492
+ }
493
+ break;
494
+ case 2:
495
+ // 工具栏被点击则不改变指针样式
496
+ if (this.data.getToolClickStatus()) break;
497
+ this.screenShotContainer.style.cursor = "ns-resize";
498
+ break;
499
+ case 3:
500
+ if (this.data.getToolClickStatus()) break;
501
+ this.screenShotContainer.style.cursor = "ew-resize";
502
+ break;
503
+ case 4:
504
+ if (this.data.getToolClickStatus()) break;
505
+ this.screenShotContainer.style.cursor = "nwse-resize";
506
+ break;
507
+ case 5:
508
+ if (this.data.getToolClickStatus()) break;
509
+ this.screenShotContainer.style.cursor = "nesw-resize";
510
+ break;
511
+ default:
512
+ break;
513
+ }
514
+ this.borderOption = this.cutOutBoxBorderArr[i].option;
515
+ flag = true;
516
+ break;
517
+ }
518
+ }
519
+ this.mouseInsideCropBox = flag;
520
+ context.closePath();
521
+ if (!flag) {
522
+ // 鼠标移出裁剪框重置鼠标样式
523
+ this.screenShotContainer.style.cursor = "default";
524
+ // 重置当前操作的边框节点为null
525
+ this.borderOption = null;
526
+ }
527
+ }
528
+ // 裁剪框正在被操作
529
+ if (this.data.getDraggingTrim()) {
530
+ // 当前操作节点为1时则为移动裁剪框
531
+ if (this.borderOption === 1) {
532
+ // 计算要移动的x轴坐标
533
+ let x = fixedData(currentX - (moveStartX - startX), width, this.screenShotContainer.width);
534
+ // 计算要移动的y轴坐标
535
+ let y = fixedData(currentY - (moveStartY - startY), height, this.screenShotContainer.height);
536
+ // 计算画布面积
537
+ const containerWidth = this.screenShotContainer.width / this.dpr;
538
+ const containerHeight = this.screenShotContainer.height / this.dpr;
539
+ // 计算裁剪框在画布上所占的面积
540
+ const cutOutBoxSizeX = x + width;
541
+ const cutOutBoxSizeY = y + height;
542
+ // 超出画布的可视区域,进行位置修正
543
+ if (cutOutBoxSizeX > containerWidth) {
544
+ x = containerWidth - width;
545
+ }
546
+ if (cutOutBoxSizeY > containerHeight) {
547
+ y = containerHeight - height;
548
+ }
549
+ // 重新绘制裁剪框
550
+ this.tempGraphPosition = drawCutOutBox(x, y, width, height, context, this.data.getBorderSize(), this.screenShotContainer, this.screenShotImageController);
551
+ } else {
552
+ // 裁剪框其他8个点的拖拽事件
553
+ const { tempStartX , tempStartY , tempWidth , tempHeight } = zoomCutOutBoxPosition(currentX, currentY, startX, startY, width, height, this.borderOption);
554
+ // 绘制裁剪框
555
+ this.tempGraphPosition = drawCutOutBox(tempStartX, tempStartY, tempWidth, tempHeight, context, this.data.getBorderSize(), this.screenShotContainer, this.screenShotImageController);
556
+ }
557
+ }
558
+ }
559
+ /**
560
+ * 显示最新的画布状态
561
+ * @private
562
+ */ showLastHistory() {
563
+ if (this.screenShotCanvas != null) {
564
+ const context = this.screenShotCanvas;
565
+ if (this.data.getHistory().length <= 0) {
566
+ addHistory();
567
+ }
568
+ context.putImageData(this.data.getHistory()[this.data.getHistory().length - 1]["data"], 0, 0);
569
+ }
570
+ }
571
+ // 为截图容器添加鼠标||触摸的事件监听
572
+ setScreenShotContainerEventListener() {
573
+ var // 设置触摸监听
574
+ _this_screenShotContainer, _this_screenShotContainer1, _this_screenShotContainer2;
575
+ if (isPC()) {
576
+ var // 添加鼠标事件监听
577
+ _this_screenShotContainer3, _this_screenShotContainer4, _this_screenShotContainer5;
578
+ (_this_screenShotContainer3 = this.screenShotContainer) === null || _this_screenShotContainer3 === void 0 ? void 0 : _this_screenShotContainer3.addEventListener("mousedown", this.mouseDownEvent);
579
+ (_this_screenShotContainer4 = this.screenShotContainer) === null || _this_screenShotContainer4 === void 0 ? void 0 : _this_screenShotContainer4.addEventListener("mousemove", this.mouseMoveEvent);
580
+ (_this_screenShotContainer5 = this.screenShotContainer) === null || _this_screenShotContainer5 === void 0 ? void 0 : _this_screenShotContainer5.addEventListener("mouseup", this.mouseUpEvent);
581
+ }
582
+ // 设备不支持触摸事件则退出
583
+ if (!isTouchDevice()) return;
584
+ (_this_screenShotContainer = this.screenShotContainer) === null || _this_screenShotContainer === void 0 ? void 0 : _this_screenShotContainer.addEventListener("touchstart", this.mouseDownEvent, false);
585
+ (_this_screenShotContainer1 = this.screenShotContainer) === null || _this_screenShotContainer1 === void 0 ? void 0 : _this_screenShotContainer1.addEventListener("touchmove", this.mouseMoveEvent, false);
586
+ (_this_screenShotContainer2 = this.screenShotContainer) === null || _this_screenShotContainer2 === void 0 ? void 0 : _this_screenShotContainer2.addEventListener("touchend", this.mouseUpEvent, false);
587
+ }
588
+ /**
589
+ * 向截图容器中绘制图片
590
+ * @param triggerCallback
591
+ * @param context
592
+ * @param imgSrc
593
+ * @private
594
+ */ drawPictures(triggerCallback, context, imgSrc) {
595
+ const imgContainer = new Image();
596
+ imgContainer.src = imgSrc;
597
+ imgContainer.width = this.screenShotImageController.width;
598
+ imgContainer.height = this.screenShotImageController.height;
599
+ imgContainer.crossOrigin = "Anonymous";
600
+ imgContainer.onload = ()=>{
601
+ var // 将用户传递的图片绘制到图片容器里
602
+ _this_screenShotImageController_getContext;
603
+ // 装载截图的dom为null则退出
604
+ if (this.screenShotContainer == null) return;
605
+ (_this_screenShotImageController_getContext = this.screenShotImageController.getContext("2d")) === null || _this_screenShotImageController_getContext === void 0 ? void 0 : _this_screenShotImageController_getContext.drawImage(imgContainer, 0, 0, this.screenShotImageController.width, this.screenShotImageController.height);
606
+ // 初始化截图容器
607
+ this.initScreenShot(triggerCallback, context, this.screenShotImageController);
608
+ };
609
+ }
610
+ /**
611
+ * 初始化截图容器
612
+ * @param triggerCallback
613
+ * @param context
614
+ * @param screenShotContainer
615
+ * @private
616
+ */ initScreenShot(triggerCallback, context, screenShotContainer) {
617
+ if (triggerCallback != null) {
618
+ // 加载成功,执行回调函数
619
+ triggerCallback({
620
+ code: 0,
621
+ msg: "截图加载完成"
622
+ });
623
+ }
624
+ // 赋值截图区域canvas画布
625
+ this.screenShotCanvas = context;
626
+ // 存储屏幕截图
627
+ this.data.setScreenShotImageController(screenShotContainer);
628
+ // 绘制蒙层
629
+ drawMasking(context, screenShotContainer);
630
+ // 截图容器添加鼠标点击/触摸事件的监听
631
+ this.setScreenShotContainerEventListener();
632
+ // 是否初始化裁剪框
633
+ if (this.cropBoxInfo != null && Object.keys(this.cropBoxInfo).length == 4) {
634
+ this.initCropBox(this.cropBoxInfo);
635
+ }
636
+ }
637
+ constructor(options){
638
+ // 当前实例的响应式data数据
639
+ _define_property(this, "data", void 0);
640
+ // video容器用于存放屏幕MediaStream流
641
+ _define_property(this, "videoController", void 0);
642
+ // 截图区域canvas容器
643
+ _define_property(this, "screenShotContainer", void 0);
644
+ _define_property(this, "screenShotDom", null);
645
+ // 截图工具栏dom
646
+ _define_property(this, "toolController", void 0);
647
+ // 截图图片存放容器
648
+ _define_property(this, "screenShotImageController", void 0);
649
+ // 截图区域画布
650
+ _define_property(this, "screenShotCanvas", void 0);
651
+ // 文本区域dom
652
+ _define_property(this, "textInputController", void 0);
653
+ // 截图工具栏画笔选项dom
654
+ _define_property(this, "optionController", void 0);
655
+ _define_property(this, "optionIcoController", void 0);
656
+ // private cutBoxSizeContainer: HTMLDivElement | null | undefined;
657
+ _define_property(this, "plugInParameters", void 0);
658
+ _define_property(this, "wrcReplyTime", 500);
659
+ _define_property(this, "keyboardEventHandle", null);
660
+ // 图形位置参数
661
+ _define_property(this, "drawGraphPosition", {
662
+ startX: 0,
663
+ startY: 0,
664
+ width: 0,
665
+ height: 0
666
+ });
667
+ // 临时图形位置参数
668
+ _define_property(this, "tempGraphPosition", {
669
+ startX: 0,
670
+ startY: 0,
671
+ width: 0,
672
+ height: 0
673
+ });
674
+ _define_property(this, "wrcImgPosition", {
675
+ x: 0,
676
+ y: 0,
677
+ w: 0,
678
+ h: 0
679
+ });
680
+ // 是否隐藏页面滚动条
681
+ _define_property(this, "hiddenScrollBar", {
682
+ color: "#000000",
683
+ fillState: false,
684
+ state: false,
685
+ fillWidth: 0,
686
+ fillHeight: 0
687
+ });
688
+ _define_property(this, "wrcWindowMode", false);
689
+ _define_property(this, "curTabState", true);
690
+ // 裁剪框边框节点坐标事件
691
+ _define_property(this, "cutOutBoxBorderArr", []);
692
+ // 当前操作的边框节点
693
+ _define_property(this, "borderOption", null);
694
+ // 点击裁剪框时的鼠标坐标
695
+ _define_property(this, "movePosition", {
696
+ moveStartX: 0,
697
+ moveStartY: 0
698
+ });
699
+ // 鼠标拖动状态
700
+ _define_property(this, "dragFlag", false);
701
+ // 单击截取屏启用状态
702
+ _define_property(this, "clickCutFullScreen", false);
703
+ // 全屏截取状态
704
+ _define_property(this, "getFullScreenStatus", false);
705
+ // 上一个裁剪框坐标信息
706
+ _define_property(this, "drawGraphPrevX", 0);
707
+ _define_property(this, "drawGraphPrevY", 0);
708
+ // 马赛克涂抹区域大小
709
+ _define_property(this, "degreeOfBlur", 5);
710
+ _define_property(this, "dpr", window.devicePixelRatio || 1);
711
+ // 截全屏时工具栏展示的位置要减去的高度
712
+ _define_property(this, "fullScreenDiffHeight", 60);
713
+ // 截图容器位置信息
714
+ _define_property(this, "position", {
715
+ left: 0,
716
+ top: 0
717
+ });
718
+ _define_property(this, "imgSrc", null);
719
+ _define_property(this, "loadCrossImg", false);
720
+ // 鼠标是否在裁剪框内
721
+ _define_property(this, "mouseInsideCropBox", false);
722
+ _define_property(this, "proxyUrl", undefined);
723
+ _define_property(this, "useCORS", false);
724
+ _define_property(this, "drawStatus", false);
725
+ // webrtc模式下的屏幕流数据
726
+ _define_property(this, "captureStream", null);
727
+ _define_property(this, "cropBoxInfo", null);
728
+ // 文本输入框位置
729
+ _define_property(this, "textInputPosition", {
730
+ mouseX: 0,
731
+ mouseY: 0
732
+ });
733
+ // 工具栏显示位置
734
+ _define_property(this, "placement", "center");
735
+ // 递增变粗箭头的实现
736
+ _define_property(this, "drawArrow", new DrawArrow());
737
+ _define_property(this, "customRightClickEvent", {
738
+ state: false
739
+ });
740
+ _define_property(this, "sendStream", (stream, cancelCallback, triggerCallback)=>{
741
+ if (stream instanceof MediaStream) {
742
+ this.videoController.srcObject = stream;
743
+ this.loadScreenFlowData(triggerCallback);
744
+ } else {
745
+ if (cancelCallback != null) {
746
+ cancelCallback({
747
+ code: -1,
748
+ msg: "视频流接入失败"
749
+ });
750
+ }
751
+ // 销毁截图组件
752
+ this.data.destroyDOM();
753
+ throw `视频流接入失败`;
754
+ }
755
+ return stream;
756
+ });
757
+ // 开始捕捉屏幕
758
+ _define_property(this, "startCapture", async (cancelCallback)=>{
759
+ let captureStream = null;
760
+ let mediaWidth = this.screenShotImageController.width * this.dpr;
761
+ let mediaHeight = this.screenShotImageController.height * this.dpr;
762
+ // let curTabState = this.curTabState;
763
+ let displayConfig = {};
764
+ // 窗口模式启用时则
765
+ if (this.wrcWindowMode) {
766
+ mediaWidth = window.screen.width * this.dpr;
767
+ mediaHeight = window.screen.height * this.dpr;
768
+ // curTabState = true;
769
+ displayConfig = {
770
+ displaySurface: "window"
771
+ };
772
+ }
773
+ try {
774
+ // console.log("开始捕捉屏幕", { mediaWidth, mediaHeight });
775
+ // 捕获屏幕
776
+ captureStream = await navigator.mediaDevices.getDisplayMedia({
777
+ audio: false,
778
+ video: _object_spread({
779
+ width: mediaWidth,
780
+ height: mediaHeight
781
+ }, displayConfig),
782
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
783
+ // @ts-ignore
784
+ // 当前标签页默认true true:不需要选择 false:需要自己选择
785
+ preferCurrentTab: this.curTabState
786
+ });
787
+ // 将MediaStream输出至video标签
788
+ this.videoController.srcObject = captureStream;
789
+ // 储存屏幕流数据
790
+ this.captureStream = captureStream;
791
+ } catch (err) {
792
+ if (cancelCallback != null) {
793
+ cancelCallback({
794
+ code: -1,
795
+ msg: "浏览器不支持webrtc或者用户未授权",
796
+ errorInfo: err
797
+ });
798
+ }
799
+ // 销毁截图组件
800
+ this.data.destroyDOM();
801
+ throw `浏览器不支持webrtc或者用户未授权( ${err} )`;
802
+ }
803
+ return captureStream;
804
+ });
805
+ // 停止捕捉屏幕
806
+ _define_property(this, "stopCapture", ()=>{
807
+ const srcObject = this.videoController.srcObject;
808
+ if (srcObject && "getTracks" in srcObject) {
809
+ const tracks = srcObject.getTracks();
810
+ tracks.forEach((track)=>track.stop());
811
+ this.videoController.srcObject = null;
812
+ }
813
+ });
814
+ // 截屏
815
+ _define_property(this, "screenShot", (cancelCallback, triggerCallback)=>{
816
+ // 开始捕捉屏幕
817
+ this.startCapture(cancelCallback).then(()=>{
818
+ this.loadScreenFlowData(triggerCallback);
819
+ });
820
+ });
821
+ // 鼠标按下事件
822
+ _define_property(this, "mouseDownEvent", (event)=>{
823
+ // 隐藏颜色选择面板
824
+ this.data.setColorPanelStatus(false);
825
+ // 隐藏文字大小选择面板
826
+ this.data.setTextSizeOptionStatus(false);
827
+ // 非鼠标左键按下则终止
828
+ if (event instanceof MouseEvent && event.button != 0) return;
829
+ // 当前处于移动端触摸时,需要在按下时判断当前坐标点是否处于裁剪框内,主动更新draggingTrim状态(移动端的move事件只会在按下时才会触发)
830
+ if (isTouchDevice() && event instanceof TouchEvent && this.screenShotCanvas) {
831
+ this.operatingCutOutBox(event.touches[0].pageX, event.touches[0].pageY, this.tempGraphPosition.startX, this.tempGraphPosition.startY, this.tempGraphPosition.width, this.tempGraphPosition.height, this.screenShotCanvas);
832
+ }
833
+ // 当前操作的是撤销
834
+ if (this.data.getToolName() == "undo") return;
835
+ this.data.setDragging(true);
836
+ this.drawStatus = false;
837
+ // 重置工具栏超出状态
838
+ this.data.setToolPositionStatus(false);
839
+ const mouseX = nonNegativeData(event instanceof MouseEvent ? event.offsetX : event.touches[0].pageX);
840
+ const mouseY = nonNegativeData(event instanceof MouseEvent ? event.offsetY : event.touches[0].pageY);
841
+ // 如果当前操作的是截图工具栏
842
+ if (this.data.getToolClickStatus()) {
843
+ // 记录当前鼠标开始坐标
844
+ this.drawGraphPosition.startX = mouseX;
845
+ this.drawGraphPosition.startY = mouseY;
846
+ }
847
+ // 当前操作的是画笔
848
+ if (this.data.getToolName() == "brush" && this.screenShotCanvas) {
849
+ // 初始化画笔
850
+ initPencil(this.screenShotCanvas, mouseX, mouseY);
851
+ }
852
+ // 当前操作的文本
853
+ if (this.data.getToolName() == "text" && this.textInputController && this.screenShotContainer && this.screenShotCanvas) {
854
+ if (!this.mouseInsideCropBox) {
855
+ return;
856
+ }
857
+ // 显示文本输入区域
858
+ this.data.setTextStatus(true);
859
+ // 判断输入框位置是否变化
860
+ if (this.textInputPosition.mouseX != 0 && this.textInputPosition.mouseY != 0 && this.textInputPosition.mouseX != mouseX && this.textInputPosition.mouseY != mouseY) {
861
+ drawText(this.textInputController.innerText, this.textInputPosition.mouseX, this.textInputPosition.mouseY, this.data.getSelectedColor(), this.data.getFontSize(), this.screenShotCanvas);
862
+ // 输入框内容不为空时则隐藏
863
+ if (this.textInputController.innerText !== "") {
864
+ // 隐藏输入框
865
+ this.data.setTextStatus(false);
866
+ }
867
+ // 清空文本输入区域的内容
868
+ this.textInputController.innerHTML = "";
869
+ // 保存绘制记录
870
+ addHistory();
871
+ }
872
+ // 计算文本框显示位置, 需要加上截图容器的位置信息
873
+ const textMouseX = mouseX + this.position.left;
874
+ // 设置文本框位置等信息
875
+ this.textInputController.style.left = textMouseX + "px";
876
+ this.textInputController.style.fontSize = this.data.getFontSize() + "px";
877
+ this.textInputController.style.fontFamily = "none";
878
+ this.textInputController.style.color = this.data.getSelectedColor();
879
+ // 部分操作需要等dom渲染完毕执行
880
+ setTimeout(()=>{
881
+ if (this.textInputController) {
882
+ // 获取输入框容器的高度
883
+ const containerHeight = this.textInputController.offsetHeight;
884
+ // 输入框容器y轴的位置需要在坐标的基础上再加上容器高度的一半,容器的位置就正好居中于光标
885
+ // canvas渲染的时候就不会出现位置不一致的问题了
886
+ const textMouseY = mouseY - Math.floor(containerHeight / 2) + this.position.top;
887
+ this.textInputController.style.top = textMouseY + "px";
888
+ // 获取焦点
889
+ this.textInputController.focus();
890
+ // 记录当前输入框位置
891
+ this.textInputPosition = {
892
+ mouseX: mouseX,
893
+ mouseY: mouseY
894
+ };
895
+ this.data.setTextInfo({
896
+ positionX: mouseX,
897
+ positionY: mouseY,
898
+ color: this.data.getSelectedColor(),
899
+ size: this.data.getFontSize()
900
+ });
901
+ }
902
+ });
903
+ }
904
+ // 如果操作的是裁剪框
905
+ if (this.borderOption) {
906
+ // 设置为拖动状态
907
+ this.data.setDraggingTrim(true);
908
+ // 记录移动时的起始点坐标
909
+ this.movePosition.moveStartX = mouseX;
910
+ this.movePosition.moveStartY = mouseY;
911
+ } else {
912
+ // 保存当前裁剪框的坐标
913
+ this.drawGraphPrevX = this.drawGraphPosition.startX;
914
+ this.drawGraphPrevY = this.drawGraphPosition.startY;
915
+ // 绘制裁剪框,记录当前鼠标开始坐标
916
+ this.drawGraphPosition.startX = mouseX;
917
+ this.drawGraphPosition.startY = mouseY;
918
+ }
919
+ });
920
+ // 鼠标移动事件
921
+ _define_property(this, "mouseMoveEvent", (event)=>{
922
+ if (this.screenShotCanvas == null || this.screenShotContainer == null || this.data.getToolName() == "undo") {
923
+ return;
924
+ }
925
+ // 去除默认事件
926
+ event.preventDefault();
927
+ // 工具栏未选择且鼠标处于按下状态时
928
+ if (!this.data.getToolClickStatus() && this.data.getDragging()) {
929
+ // 修改拖动状态为true;
930
+ this.dragFlag = true;
931
+ // 隐藏截图工具栏
932
+ // this.data.setToolStatus(false);
933
+ // 隐藏裁剪框尺寸显示容器
934
+ // this.data.setCutBoxSizeStatus(false);
935
+ }
936
+ // 获取当前绘制中的工具位置信息
937
+ const { startX , startY , width , height } = this.drawGraphPosition;
938
+ // 获取当前鼠标坐标
939
+ const currentX = nonNegativeData(event instanceof MouseEvent ? event.offsetX : event.touches[0].pageX);
940
+ const currentY = nonNegativeData(event instanceof MouseEvent ? event.offsetY : event.touches[0].pageY);
941
+ // 绘制中工具的临时宽高
942
+ const tempWidth = currentX - startX;
943
+ const tempHeight = currentY - startY;
944
+ // 工具栏绘制
945
+ if (this.data.getToolClickStatus() && this.data.getDragging()) {
946
+ // 获取裁剪框位置信息
947
+ const cutBoxPosition = this.data.getCutOutBoxPosition();
948
+ // 绘制中工具的起始x、y坐标不能小于裁剪框的起始坐标
949
+ // 绘制中工具的起始x、y坐标不能大于裁剪框的结束标作
950
+ // 当前鼠标的x坐标不能小于裁剪框起始x坐标,不能大于裁剪框的结束坐标
951
+ // 当前鼠标的y坐标不能小于裁剪框起始y坐标,不能大于裁剪框的结束坐标
952
+ if (!getDrawBoundaryStatus(startX, startY, cutBoxPosition) || !getDrawBoundaryStatus(currentX, currentY, cutBoxPosition)) return;
953
+ // 当前操作的不是马赛克则显示最后一次画布绘制时的状态
954
+ if (this.data.getToolName() != "mosaicPen") {
955
+ this.showLastHistory();
956
+ this.drawStatus = true;
957
+ }
958
+ switch(this.data.getToolName()){
959
+ case "square":
960
+ drawRectangle(startX, startY, tempWidth, tempHeight, this.data.getSelectedColor(), this.data.getPenSize(), this.screenShotCanvas);
961
+ break;
962
+ case "round":
963
+ drawCircle(this.screenShotCanvas, currentX, currentY, startX, startY, this.data.getPenSize(), this.data.getSelectedColor());
964
+ break;
965
+ case "right-top":
966
+ // 绘制等比例箭头
967
+ if (this.plugInParameters.getRatioArrow()) {
968
+ drawLineArrow(this.screenShotCanvas, startX, startY, currentX, currentY, 30, 10, this.data.getPenSize(), this.data.getSelectedColor());
969
+ return;
970
+ }
971
+ this.drawArrow.draw(this.screenShotCanvas, startX, startY, currentX, currentY, this.data.getSelectedColor(), this.data.getPenSize());
972
+ break;
973
+ case "brush":
974
+ // 画笔绘制
975
+ drawPencil(this.screenShotCanvas, currentX, currentY, this.data.getPenSize(), this.data.getSelectedColor());
976
+ break;
977
+ case "mosaicPen":
978
+ // 当前为马赛克工具则修改绘制状态
979
+ // 前面做了判断,此处需要特殊处理
980
+ if (!this.drawStatus) {
981
+ this.showLastHistory();
982
+ this.drawStatus = true;
983
+ }
984
+ // 绘制马赛克,为了确保鼠标位置在绘制区域中间,所以对x、y坐标进行-10处理
985
+ drawMosaic(currentX - 10, currentY - 10, this.data.getMosaicPenSize(), this.degreeOfBlur, this.screenShotCanvas);
986
+ break;
987
+ default:
988
+ break;
989
+ }
990
+ return;
991
+ }
992
+ // 执行裁剪框操作函数
993
+ this.operatingCutOutBox(currentX, currentY, startX, startY, width, height, this.screenShotCanvas);
994
+ // 如果鼠标未点击或者当前操作的是裁剪框都return
995
+ if (!this.data.getDragging() || this.data.getDraggingTrim()) return;
996
+ // 绘制裁剪框
997
+ this.tempGraphPosition = drawCutOutBox(startX, startY, tempWidth, tempHeight, this.screenShotCanvas, this.data.getBorderSize(), this.screenShotContainer, this.screenShotImageController);
998
+ });
999
+ // 鼠标抬起事件
1000
+ _define_property(this, "mouseUpEvent", ()=>{
1001
+ // 当前操作的是撤销
1002
+ if (this.data.getToolName() == "undo") return;
1003
+ // 绘制结束
1004
+ this.data.setDragging(false);
1005
+ this.data.setDraggingTrim(false);
1006
+ // 截图容器判空
1007
+ if (this.screenShotCanvas == null || this.screenShotContainer == null) {
1008
+ return;
1009
+ }
1010
+ // 工具栏未点击且鼠标未拖动且单击截屏状态为false则复原裁剪框位置
1011
+ if (!this.data.getToolClickStatus() && !this.dragFlag && !this.clickCutFullScreen) {
1012
+ // 复原裁剪框的坐标
1013
+ this.drawGraphPosition.startX = this.drawGraphPrevX;
1014
+ this.drawGraphPosition.startY = this.drawGraphPrevY;
1015
+ return;
1016
+ }
1017
+ // 调用者尚未拖拽生成选区
1018
+ // 鼠标尚未拖动
1019
+ // 单击截取屏幕状态为true
1020
+ // 则截取整个屏幕
1021
+ const cutBoxPosition = this.data.getCutOutBoxPosition();
1022
+ if (cutBoxPosition.width === 0 && cutBoxPosition.height === 0 && cutBoxPosition.startX === 0 && cutBoxPosition.startY === 0 && !this.dragFlag && this.clickCutFullScreen) {
1023
+ const borderSize = this.data.getBorderSize();
1024
+ this.getFullScreenStatus = true;
1025
+ // 设置裁剪框位置为全屏
1026
+ this.tempGraphPosition = drawCutOutBox(0, 0, this.screenShotContainer.width - borderSize / 2, this.screenShotContainer.height - borderSize / 2, this.screenShotCanvas, borderSize, this.screenShotContainer, this.screenShotImageController);
1027
+ }
1028
+ if (this.screenShotContainer == null || this.screenShotCanvas == null) {
1029
+ return;
1030
+ }
1031
+ // 工具栏已点击且进行了绘制
1032
+ if (this.data.getToolClickStatus() && this.drawStatus) {
1033
+ // 保存绘制记录
1034
+ addHistory();
1035
+ return;
1036
+ } else if (this.data.getToolClickStatus() && !this.drawStatus) {
1037
+ // 工具栏点击了但尚未进行绘制
1038
+ return;
1039
+ }
1040
+ // 保存绘制后的图形位置信息
1041
+ this.drawGraphPosition = this.tempGraphPosition;
1042
+ // 如果工具栏未点击则保存裁剪框位置
1043
+ if (!this.data.getToolClickStatus()) {
1044
+ const { startX , startY , width , height } = this.drawGraphPosition;
1045
+ this.data.setCutOutBoxPosition(startX, startY, width, height);
1046
+ }
1047
+ // 保存边框节点信息
1048
+ this.cutOutBoxBorderArr = saveBorderArrInfo(this.data.getBorderSize(), this.drawGraphPosition);
1049
+ // 鼠标按下且拖动时重新渲染工具栏
1050
+ if (this.screenShotContainer != null && this.dragFlag || this.clickCutFullScreen) {
1051
+ // 修改鼠标状态为拖动
1052
+ this.screenShotContainer.style.cursor = "move";
1053
+ // 显示截图工具栏
1054
+ // this.data.setToolStatus(true);
1055
+ // // 显示裁剪框尺寸显示容器
1056
+ // this.data.setCutBoxSizeStatus(true);
1057
+ // 复原拖动状态
1058
+ this.dragFlag = false;
1059
+ if (this.toolController != null) {
1060
+ this.showToolBar();
1061
+ }
1062
+ }
1063
+ });
1064
+ this.plugInParameters = new PlugInParameters();
1065
+ // 提取options中的有用参数设置到全局参数中
1066
+ setPlugInParameters(options);
1067
+ // 创建截图所需dom并设置回调函数
1068
+ new CreateDom(options);
1069
+ // 创建并获取webrtc模式所需要的辅助dom
1070
+ this.videoController = document.createElement("video");
1071
+ this.videoController.autoplay = true;
1072
+ this.screenShotImageController = document.createElement("canvas");
1073
+ // 实例化响应式data
1074
+ this.data = new InitData();
1075
+ // 设置插件的可选参数
1076
+ this.setOptionalParameter(options);
1077
+ // 获取截图区域canvas容器(获取的同时也会为InitData中的全局变量赋值)
1078
+ this.setGlobalParameter();
1079
+ // 修改截图容器可滚动状态
1080
+ this.data.setNoScrollStatus(options === null || options === void 0 ? void 0 : options.noScroll);
1081
+ // 加载截图组件
1082
+ this.load(options === null || options === void 0 ? void 0 : options.triggerCallback, options === null || options === void 0 ? void 0 : options.cancelCallback);
1083
+ if (this.toolController == null || this.screenShotContainer == null || this.textInputController == null) {
1084
+ return;
1085
+ }
1086
+ // 截图组件加载完毕后,对层级进行调整
1087
+ this.adjustContainerLevels((options === null || options === void 0 ? void 0 : options.level) ? options.level : 0);
1088
+ // 创建键盘事件监听
1089
+ this.keyboardEventHandle = new KeyboardEventHandle(this.screenShotContainer, this.toolController);
1090
+ // 给输入容器设置快捷键监听
1091
+ this.registerContainerShortcuts(this.textInputController);
1092
+ if (this.customRightClickEvent.state) {
1093
+ // 给截图容器添加右键事件监听
1094
+ this.registerForRightClickEvent(this.screenShotContainer);
1095
+ }
1096
+ }
1097
+ }
1098
+ export { ScreenShot as default };