ascript 1.3.27__py3-none-win_amd64.whl

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 (177) hide show
  1. ascript/__init__.py +8 -0
  2. ascript/hooks/__init__.py +0 -0
  3. ascript/hooks/hook-ascript.py +2 -0
  4. ascript/windows/__init__.py +29 -0
  5. ascript/windows/daos/__init__.py +0 -0
  6. ascript/windows/daos/screen.py +143 -0
  7. ascript/windows/hardware/__init__.py +5 -0
  8. ascript/windows/hardware/keyboard.py +279 -0
  9. ascript/windows/hardware/logitech_driver.py +179 -0
  10. ascript/windows/hardware/mouse.py +308 -0
  11. ascript/windows/license/__init__.py +16 -0
  12. ascript/windows/license/achttp.cp310-win_amd64.pyd +0 -0
  13. ascript/windows/license/achttp.cp311-win_amd64.pyd +0 -0
  14. ascript/windows/license/achttp.cp312-win_amd64.pyd +0 -0
  15. ascript/windows/license/achttp.cp313-win_amd64.pyd +0 -0
  16. ascript/windows/license/achttp.cp314-win_amd64.pyd +0 -0
  17. ascript/windows/license/achttp.cp38-win_amd64.pyd +0 -0
  18. ascript/windows/license/achttp.cp39-win_amd64.pyd +0 -0
  19. ascript/windows/media/__init__.py +0 -0
  20. ascript/windows/resources/__init__.py +0 -0
  21. ascript/windows/resources/libs/logitech/x64/LogitechGkeyEnginesWrapper.dll +0 -0
  22. ascript/windows/resources/libs/logitech/x86/LogitechGkeyEnginesWrapper.dll +0 -0
  23. ascript/windows/resources/templates/__init__.py +0 -0
  24. ascript/windows/resources/templates/__init__py.win.template +51 -0
  25. ascript/windows/resources/templates/build.as.win.template +14 -0
  26. ascript/windows/resources/templates/build.py +71 -0
  27. ascript/windows/resources/templates/logo_windows.ico +0 -0
  28. ascript/windows/resources/templates/windows/main.py +50 -0
  29. ascript/windows/resources/templates/windows/pyproject.toml +44 -0
  30. ascript/windows/resources/templates/windows/res/img/logo.ico +0 -0
  31. ascript/windows/screen/__init__.py +13 -0
  32. ascript/windows/screen/as_cv.py +382 -0
  33. ascript/windows/screen/canny.py +128 -0
  34. ascript/windows/screen/code_scanner.py +72 -0
  35. ascript/windows/screen/color_algorithms.py +277 -0
  36. ascript/windows/screen/find_colors.py +251 -0
  37. ascript/windows/screen/find_images.py +217 -0
  38. ascript/windows/screen/ocr/__init__.py +4 -0
  39. ascript/windows/screen/ocr/ocr.py +223 -0
  40. ascript/windows/screen/ocr/rapidocr_hook.py +301 -0
  41. ascript/windows/screen/ocrx.py +169 -0
  42. ascript/windows/screen/screen_core.py +139 -0
  43. ascript/windows/store/__init__.py +21 -0
  44. ascript/windows/system/__init__.py +8 -0
  45. ascript/windows/system/device.py +355 -0
  46. ascript/windows/system/easy_print.py +115 -0
  47. ascript/windows/system/env.py +492 -0
  48. ascript/windows/system/exception/__init__.py +1 -0
  49. ascript/windows/system/key_value.py +145 -0
  50. ascript/windows/system/pip.py +175 -0
  51. ascript/windows/system/r.py +165 -0
  52. ascript/windows/system/runtime.py +62 -0
  53. ascript/windows/tools/__init__.py +27 -0
  54. ascript/windows/tools/__main__.py +21 -0
  55. ascript/windows/tools/action.json +33 -0
  56. ascript/windows/tools/action.py +168 -0
  57. ascript/windows/tools/colors_tool.py +391 -0
  58. ascript/windows/tools/config.py +26 -0
  59. ascript/windows/tools/dumptool.py +18 -0
  60. ascript/windows/tools/eel_api.py +495 -0
  61. ascript/windows/tools/gpplug/__init__.py +0 -0
  62. ascript/windows/tools/gpplug/plug.py +70 -0
  63. ascript/windows/tools/mouse_catch.py +168 -0
  64. ascript/windows/tools/plug_manager.py +38 -0
  65. ascript/windows/tools/tool_api.py +906 -0
  66. ascript/windows/tools/tool_window.py +56 -0
  67. ascript/windows/tools/uia_worker.py +365 -0
  68. ascript/windows/tools/web/app_store_window.html +481 -0
  69. ascript/windows/tools/web/colors.html +532 -0
  70. ascript/windows/tools/web/css/screen.css +1342 -0
  71. ascript/windows/tools/web/css/viewtree.css +357 -0
  72. ascript/windows/tools/web/flot_control.html +195 -0
  73. ascript/windows/tools/web/img/ico/favicon.png +0 -0
  74. ascript/windows/tools/web/img/ico/paintpalette.png +0 -0
  75. ascript/windows/tools/web/img/svg/find_colors.svg +1 -0
  76. ascript/windows/tools/web/img/svg/find_images.svg +1 -0
  77. ascript/windows/tools/web/img/svg/illustration-6.svg +89 -0
  78. ascript/windows/tools/web/img/svg/img_default.svg +1 -0
  79. ascript/windows/tools/web/img/svg/ocr.svg +1 -0
  80. ascript/windows/tools/web/js/screen/colors.js +466 -0
  81. ascript/windows/tools/web/js/screen/gp_plug.js +108 -0
  82. ascript/windows/tools/web/js/screen/image_mouse.js +464 -0
  83. ascript/windows/tools/web/js/screen/img_view.js +558 -0
  84. ascript/windows/tools/web/js/screen/plug.js +246 -0
  85. ascript/windows/tools/web/js/screen/screen.js +690 -0
  86. ascript/windows/tools/web/js/screen/screen_api.js +778 -0
  87. ascript/windows/tools/web/js/screen/screen_maker.js +10 -0
  88. ascript/windows/tools/web/js/utils/map.js +73 -0
  89. ascript/windows/tools/web/js/utils/upload.js +157 -0
  90. ascript/windows/tools/web/js/viewtree/niv_js.js +27 -0
  91. ascript/windows/tools/web/js/viewtree/vtree.js +1510 -0
  92. ascript/windows/tools/web/libs/bootstrap/css/bootstrap.min.css +6 -0
  93. ascript/windows/tools/web/libs/bootstrap/js/bootstrap.bundle.min.js +7 -0
  94. ascript/windows/tools/web/libs/bootstrap-icons/0-circle.svg +4 -0
  95. ascript/windows/tools/web/libs/bootstrap-icons/0-square.svg +4 -0
  96. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.css +2078 -0
  97. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.json +2052 -0
  98. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.min.css +5 -0
  99. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.scss +2090 -0
  100. ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff +0 -0
  101. ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff2 +0 -0
  102. ascript/windows/tools/web/libs/feather-icons/dist/feather.min.js +13 -0
  103. ascript/windows/tools/web/libs/feather-icons/dist/icons.json +1 -0
  104. ascript/windows/tools/web/libs/jquery/core.js +399 -0
  105. ascript/windows/tools/web/libs/jquery/jquery.js +10598 -0
  106. ascript/windows/tools/web/libs/jquery/jquery.min.js +4 -0
  107. ascript/windows/tools/web/libs/jquery/jquery.min.js.zip +0 -0
  108. ascript/windows/tools/web/libs/jquery/jquery.slim.js +8495 -0
  109. ascript/windows/tools/web/libs/jquery/jquery.slim.min.js +2 -0
  110. ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.js +2134 -0
  111. ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.min.css +16 -0
  112. ascript/windows/tools/web/libs/jquery-zTree/css/zTreeStyle.css +97 -0
  113. ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_close.png +0 -0
  114. ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_open.png +0 -0
  115. ascript/windows/tools/web/libs/jquery-zTree/img/diy/2.png +0 -0
  116. ascript/windows/tools/web/libs/jquery-zTree/img/diy/3.png +0 -0
  117. ascript/windows/tools/web/libs/jquery-zTree/img/diy/4.png +0 -0
  118. ascript/windows/tools/web/libs/jquery-zTree/img/diy/5.png +0 -0
  119. ascript/windows/tools/web/libs/jquery-zTree/img/diy/6.png +0 -0
  120. ascript/windows/tools/web/libs/jquery-zTree/img/diy/7.png +0 -0
  121. ascript/windows/tools/web/libs/jquery-zTree/img/diy/8.png +0 -0
  122. ascript/windows/tools/web/libs/jquery-zTree/img/diy/9.png +0 -0
  123. ascript/windows/tools/web/libs/jquery-zTree/img/line_conn.gif +0 -0
  124. ascript/windows/tools/web/libs/jquery-zTree/img/loading.gif +0 -0
  125. ascript/windows/tools/web/libs/jquery-zTree/img/tree-node-btn.png +0 -0
  126. ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.gif +0 -0
  127. ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.png +0 -0
  128. ascript/windows/tools/web/libs/jquery-zTree/js/jquery.ztree.all.min.js +3 -0
  129. ascript/windows/tools/web/libs/treeview/css/jquery.treeview.css +79 -0
  130. ascript/windows/tools/web/libs/treeview/img/file.png +0 -0
  131. ascript/windows/tools/web/libs/treeview/img/ico_loading.png +0 -0
  132. ascript/windows/tools/web/libs/treeview/img/icon4.png +0 -0
  133. ascript/windows/tools/web/libs/treeview/img/icon5.png +0 -0
  134. ascript/windows/tools/web/libs/treeview/img/icon6.png +0 -0
  135. ascript/windows/tools/web/libs/treeview/img/py.png +0 -0
  136. ascript/windows/tools/web/libs/treeview/img/treeview-black-line.gif +0 -0
  137. ascript/windows/tools/web/libs/treeview/img/treeview-black.gif +0 -0
  138. ascript/windows/tools/web/libs/treeview/img/treeview-default-line.gif +0 -0
  139. ascript/windows/tools/web/libs/treeview/img/treeview-default.gif +0 -0
  140. ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam-line.gif +0 -0
  141. ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam.gif +0 -0
  142. ascript/windows/tools/web/libs/treeview/img/treeview-gray-line.gif +0 -0
  143. ascript/windows/tools/web/libs/treeview/img/treeview-gray.gif +0 -0
  144. ascript/windows/tools/web/libs/treeview/img/treeview-red-line.gif +0 -0
  145. ascript/windows/tools/web/libs/treeview/img/treeview-red.gif +0 -0
  146. ascript/windows/tools/web/libs/treeview/js/jquery.treeview.edit.js +37 -0
  147. ascript/windows/tools/web/libs/treeview/js/jquery.treeview.js +250 -0
  148. ascript/windows/tools/web/license_window.html +255 -0
  149. ascript/windows/tools/web/plugs/a.html +653 -0
  150. ascript/windows/tools/web/plugs/demo.html +52 -0
  151. ascript/windows/tools/web/plugs/find_colors.html +629 -0
  152. ascript/windows/tools/web/plugs/find_images.html +699 -0
  153. ascript/windows/tools/web/plugs/rapidocr.html +954 -0
  154. ascript/windows/tools/web/vtree.html +496 -0
  155. ascript/windows/tools/webview/assets/index-HymBPl-I.css +1 -0
  156. ascript/windows/tools/webview/assets/index-PqA_m8tL.js +17 -0
  157. ascript/windows/tools/webview/index.html +13 -0
  158. ascript/windows/ui/__init__.py +6 -0
  159. ascript/windows/ui/app_store_window.py +272 -0
  160. ascript/windows/ui/draw_window.py +231 -0
  161. ascript/windows/ui/flot_test.py +297 -0
  162. ascript/windows/ui/flot_window.py +488 -0
  163. ascript/windows/ui/license_window.py +111 -0
  164. ascript/windows/ui/web_window.py +466 -0
  165. ascript/windows/utils/__init__.py +0 -0
  166. ascript/windows/utils/node_utils.py +20 -0
  167. ascript/windows/utils/screen_utils.py +280 -0
  168. ascript/windows/window/Selector.py +1015 -0
  169. ascript/windows/window/Window.py +747 -0
  170. ascript/windows/window/__init__.py +5 -0
  171. ascript/windows/window/launcher.py +213 -0
  172. ascript/windows/window/uia_runtime.py +26 -0
  173. ascript-1.3.27.dist-info/METADATA +41 -0
  174. ascript-1.3.27.dist-info/RECORD +177 -0
  175. ascript-1.3.27.dist-info/WHEEL +5 -0
  176. ascript-1.3.27.dist-info/entry_points.txt +2 -0
  177. ascript-1.3.27.dist-info/top_level.txt +1 -0
@@ -0,0 +1,108 @@
1
+ window.gp = {
2
+ window: {
3
+ title: null,
4
+ hwnd: null
5
+ },
6
+ image: {
7
+ path: null,
8
+ selection: [],
9
+ load: null
10
+ },
11
+ marks: {
12
+ clear: null,
13
+ add_point: null,
14
+ add_rect: null,
15
+ high_light:null,
16
+ high_light_clear:null
17
+ },
18
+ iframe: {
19
+ window: null,
20
+ on_area_selected: null,
21
+ on_color_picked: null,
22
+ on_image_loaded: null
23
+ },
24
+ info:{
25
+ error:null,
26
+ noti:null
27
+ },
28
+ call_python: async function callPython(code) {
29
+ const res = await eel.python_executor(code)();
30
+
31
+ if (!res.success) {
32
+ console.error(`[%c${res.error.type}%c]: ${res.error.message}`, "color: red; font-weight: bold", "");
33
+ console.groupCollapsed("查看完整堆栈信息 (Traceback)");
34
+ console.log(res.error.traceback);
35
+ console.groupEnd();
36
+
37
+ // 也可以弹出 UI 提示
38
+ // MyUI.showError(res.error.message);
39
+ // alert(`错误类型: ${res.error.type}\n错误信息: ${res.error.message}`);
40
+ window.gp.info.error(`执行Python异常`, `错误类型: ${res.error.type}\n错误信息: ${res.error.message}\n${res.error.traceback}`);
41
+ return null;
42
+ }
43
+ return res.data;
44
+ }
45
+ }
46
+
47
+ $(document).ready(function () {
48
+ window.gp.image.load = showImg;
49
+ window.gp.marks.add_point = window.addPointMark;
50
+ window.gp.marks.add_rect = window.addRectMark;
51
+ window.gp.marks.clear = window.clearAllMarks;
52
+ window.gp.marks.high_light = window.highlightMark;
53
+ window.gp.marks.high_light_clear = window.clearHighlight;
54
+ window.gp.info.error = window.showError;
55
+ window.gp.info.noti = window.showBottomNotif;
56
+
57
+ window.gp.iframe.on_area_selected = function () {
58
+ // 1. 获取全局变量 box
59
+ var b = box;
60
+ if (!b) {
61
+ console.warn("Global 'box' is not defined yet.");
62
+ return;
63
+ }
64
+
65
+ // 2. 根据日志显示的属性名 {x, y, w, h} 进行提取
66
+ // 使用 Math.floor 向下取整
67
+ var left = Math.floor(b.x || 0);
68
+ var top = Math.floor(b.y || 0);
69
+ var width = Math.floor(b.w || 0);
70
+ var height = Math.floor(b.h || 0);
71
+
72
+ // 3. 转换为 LTRB 格式
73
+ var ltrbBox = {
74
+ l: left,
75
+ t: top,
76
+ r: left + width,
77
+ b: top + height
78
+ };
79
+
80
+ console.log("Corrected LTRB:", ltrbBox);
81
+
82
+ // 4. 更新全局状态
83
+ window.gp.image.selection = ltrbBox;
84
+
85
+ // 5. 传给 iframe 内部
86
+ if (window.gp.iframe.window && typeof window.gp.iframe.window.on_area_selected === 'function') {
87
+ return window.gp.iframe.window.on_area_selected(ltrbBox);
88
+ }
89
+ };
90
+
91
+ window.gp.iframe.on_color_picked = function (...args) {
92
+ window.gp.image.selection = box;
93
+ if (window.gp.iframe.window && typeof window.gp.iframe.window.on_color_picked === 'function') {
94
+ return window.gp.iframe.window.on_color_picked(...args);
95
+ }
96
+ }
97
+
98
+ window.gp.iframe.on_image_loaded = function (...args) {
99
+ window.gp.image.selection = box;
100
+ if (window.gp.iframe.window && typeof window.gp.iframe.window.on_image_loaded === 'function') {
101
+ return window.gp.iframe.window.on_image_loaded(...args);
102
+ }
103
+ }
104
+
105
+
106
+ // window.addPointMark("1",100,100)
107
+
108
+ });
@@ -0,0 +1,464 @@
1
+ var info_RGB = $("#header_cur_rgb");
2
+ var info_color = $("#header_cur_colrshow");
3
+ var scope_pos = [null, null];
4
+ var part_box = $("#part_box");
5
+ var conimg = $("#container_img");
6
+
7
+ var part_control_i = [$("#p_i_l"), $("#p_i_t"), $("#p_i_r"), $("#p_i_b")]
8
+ var part_control_c = [$("#p_b_l_c"), $("#p_b_t_c"), $("#p_b_r_c"), $("#p_b_b_c")]
9
+ var part_control_a = [$("#p_b_l_a"), $("#p_b_t_a"), $("#p_b_r_a"), $("#p_b_b_a")]
10
+
11
+ var hasFocus = true;
12
+
13
+ $(".pb_con").hide()
14
+
15
+ window.addEventListener('blur', function() {
16
+ hasFocus = false;
17
+ });
18
+
19
+ window.addEventListener('focus', function() {
20
+ hasFocus = true;
21
+ });
22
+
23
+
24
+ //获取鼠标在图片上的位置及颜色(像素级)
25
+ function getPointOfImage() {
26
+ //获取鼠标相对于整个页面的位置
27
+ var pos = mousePos();
28
+ var page_mouse_x = pos.x
29
+ var page_mouse_y = pos.y;
30
+ //获取图片元素的左上角的位置
31
+ var img_x = getLeft(image);
32
+ var img_y = getTop(image);
33
+ //获取容器滚动条滚动的距离
34
+ var distance_scroll_x = $("#container_img").scrollLeft();
35
+ var distance_scroll_y = $("#container_img").scrollTop();
36
+ //获取图片元素的宽度(实际的,而不仅是显示的)
37
+ var img_width = image.offsetWidth;
38
+ img_height = image.offsetHeight;
39
+ //计算鼠标所在的图片上的位置距离左上角起始点的距离占宽高的百分比
40
+ var percent_x = (page_mouse_x - img_x + distance_scroll_x) / img_width;
41
+ var percent_y = (page_mouse_y - img_y + distance_scroll_y) / img_height;
42
+ //获取图片的原始像素级坐标和颜色
43
+ var pos_pixel_x = image_data_object.width * percent_x;
44
+ var pos_pixel_y = image_data_object.height * percent_y;
45
+ pos_pixel_x = Math.floor(pos_pixel_x);
46
+ // pos_pixel_x = toInt(pos_pixel_x, 0.9);
47
+ pos_pixel_y = Math.floor(pos_pixel_y);
48
+ // pos_pixel_y = toInt(pos_pixel_y, 0.9);
49
+ var index = (pos_pixel_x + 1 + (pos_pixel_y) * image_data_object.width - 1) * 4;
50
+ var pos_pixel_color = {
51
+ r: image_data_object.data[index],
52
+ g: image_data_object.data[index + 1],
53
+ b: image_data_object.data[index + 2],
54
+ a: image_data_object.data[index + 3]
55
+ };
56
+ return { x: pos_pixel_x, y: pos_pixel_y, color: pos_pixel_color };
57
+ }
58
+
59
+ function mousePos() {
60
+ var x, y;
61
+ var e = window.event;
62
+ return {
63
+ x: e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
64
+ y: e.clientY + document.body.scrollTop + document.documentElement.scrollTop
65
+ };
66
+ };
67
+
68
+ //获取元素的纵坐标
69
+ function getTop(e) {
70
+ var offset = e.offsetTop;
71
+ if (e.offsetParent != null) offset += getTop(e.offsetParent);
72
+ return offset;
73
+ }
74
+
75
+ //获取元素的横坐标
76
+ function getLeft(e) {
77
+ var offset = e.offsetLeft;
78
+ if (e.offsetParent != null) offset += getLeft(e.offsetParent);
79
+ return offset;
80
+ }
81
+
82
+
83
+ function img_mousemove(e) {
84
+
85
+ if(!hasFocus){
86
+ return true;
87
+ }
88
+
89
+ if(is_imgcon_mouse_down){
90
+ return true
91
+ }
92
+
93
+ // if(!$("#img_preview").is(':focus')){
94
+ // $("#img_preview").focus()
95
+ // // alert("1")
96
+ // console.log("focus -img ")
97
+ // $('#screen_logo').click();
98
+
99
+ // }
100
+
101
+ //处理显示鼠标坐标点图色信息的逻辑
102
+ is_image_mouseover = true;
103
+ // $(".choose_colors_item_input").blur()
104
+
105
+ var current_pos = getPointOfImage();
106
+
107
+ showZoomCon(current_pos)
108
+ pos_current = current_pos;
109
+
110
+ $("#header_cur_xy").text("x:" + current_pos.x + " y:" + current_pos.y);
111
+
112
+ // im.focus();
113
+
114
+ // alert(current_pos.y+"?"+current_pos.x)
115
+
116
+ // info_Y.text("Y:" + current_pos.y);
117
+ var r = current_pos.color.r.toString(16);
118
+ var g = current_pos.color.g.toString(16);
119
+ var b = current_pos.color.b.toString(16);
120
+ r = r.length > 1 ? r : "0" + r;
121
+ g = g.length > 1 ? g : "0" + g;
122
+ b = b.length > 1 ? b : "0" + b;
123
+ var rgb_str = r.toUpperCase() + g.toUpperCase() + b.toUpperCase();
124
+ $("#header_cur_rgb").text("#" + rgb_str);
125
+ $(".toolbar_img_delall-mousecolor").css("background-color", "#" + rgb_str);
126
+
127
+ mouse_move_xyc = { x: current_pos.x, y: current_pos.y, c: rgb_str };
128
+
129
+
130
+ //处理拖动鼠标选择范围的逻辑
131
+ if (!is_mouse_downed) { //如果鼠标不是按下状态,直接退出
132
+ return false;
133
+ }
134
+ if (!is_show_box) {
135
+ is_show_box = true;
136
+ }
137
+ var pos = mouseParentPos(e);
138
+ var x_current = pos.x;
139
+ var y_current = pos.y;
140
+ var width = x_current - x_mouse_down;
141
+ var height = y_current - y_mouse_down;
142
+ part_box.css("width", width + "px");
143
+ part_box.css("height", height + "px");
144
+ if (width > 0 & height > 0) {
145
+ part_box.css("display", "block");
146
+ // p2.val(current_pos.x + "," + current_pos.y);
147
+ // alert(1)
148
+ // $(".pb_con_empty").hide()
149
+ // $(".pb_con").show()
150
+ scope_pos[1] = current_pos;
151
+ // part_control_i[0].text(pos_mouse_down.x)
152
+ // part_control_i[1].text(pos_mouse_down.y)
153
+ // part_control_i[2].text(current_pos.x)
154
+ // part_control_i[3].text(current_pos.y)
155
+ // $(".image_input_rect").val(pos_mouse_down.x + "," + pos_mouse_down.y + "," + current_pos.x + "," + current_pos.y);
156
+
157
+ } else {
158
+ // $(".badge .badge").text("0")
159
+ $(".pb_con").hide()
160
+ }
161
+
162
+ scope_pos[0] = pos_mouse_down;
163
+
164
+ // generate_code();
165
+ return false;
166
+ }
167
+
168
+ function img_onmouseout(e) {
169
+ // $(".zoomWindow").fadeOut(200,function(e){
170
+ is_image_mouseover = false;
171
+ // });
172
+ $(".zoomContainer").hide();
173
+ }
174
+
175
+
176
+ function img_mousedown(e) {
177
+ // alert(conimg.scrollTop())
178
+
179
+ if(!hasFocus){
180
+ return true;
181
+ }
182
+
183
+ var currentTrigger = $("#img_preview").data('contextMenuActive', true)
184
+ var opt = currentTrigger.data('contextMenu') || {};
185
+ if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {
186
+ opt.$menu.trigger('contextmenu:hide');
187
+ }
188
+
189
+ scope_pos = [null, null];
190
+ $(".image_input_rect").val("")
191
+ // if(findimage_capture){
192
+ // scope_pos_findimg = [null, null];
193
+ // }
194
+ // $("#header_rect").val("");
195
+ // $(".pb_con_empty").show()
196
+ // $(".pb_con").hide()
197
+ is_mouse_downed = true;
198
+ var pos = mouseParentPos(e);
199
+ x_mouse_down = pos.x;
200
+ y_mouse_down = pos.y;
201
+ $("#part_box").removeClass("shadow-lg");
202
+ part_box.css("left", x_mouse_down + "px");
203
+ part_box.css("top", y_mouse_down + "px");
204
+ part_box.css("width", "0px");
205
+ part_box.css("height", "0px");
206
+ part_box.css("display", "none");
207
+ pos_mouse_down = getPointOfImage();
208
+ is_show_box = false;
209
+
210
+ return false;
211
+
212
+
213
+ }
214
+
215
+ function hide_rect() {
216
+ $("#part_box").removeClass("shadow-lg");
217
+ part_box.css("left", 0 + "px");
218
+ part_box.css("top", 0 + "px");
219
+ part_box.css("width", "0px");
220
+ part_box.css("height", "0px");
221
+ part_box.css("display", "none");
222
+ }
223
+
224
+ function img_mouseup(e) {
225
+
226
+ if(!hasFocus){
227
+ // hasFocus = true
228
+ return false;
229
+ }
230
+
231
+ is_mouse_downed = false;
232
+
233
+ $(".part_box_control").show()
234
+
235
+ change_part_rect(true)
236
+
237
+ copyToClipboard(scope_pos[0].x + "," + scope_pos[0].y + "," + scope_pos[1].x + "," + scope_pos[1].y, " 此选中范围,已复制区域坐标到剪贴板!");
238
+
239
+ return false;
240
+
241
+ }
242
+
243
+ function change_part_rect(noti_frame) {
244
+
245
+ changeBoxRect();
246
+
247
+ changeImageMarkSize();
248
+
249
+ }
250
+
251
+
252
+ //获取鼠标针对于父元素的位置
253
+ function mouseParentPos(e) {
254
+ var x, y;
255
+ conimg = $("#container_img");
256
+ return {
257
+ x: e.clientX - conimg.offset().left + conimg.scrollLeft(),
258
+ y: e.clientY - conimg.offset().top + conimg.scrollTop()
259
+ };
260
+ };
261
+
262
+ function changeBoxRect() {
263
+
264
+ // alert(conimg.scrollLeft())
265
+ var boxp = part_box.position();
266
+ var boxwidth = part_box.width();
267
+ var boxheight = part_box.height();
268
+ var maxWidth = conimg.width() - 20;
269
+ var maxHeight = conimg.height();
270
+
271
+ var relwidth = maxWidth / (boxwidth / image.width);
272
+ var relHeight = relwidth / (image.width / image.height);
273
+ var relBoxWidth = (boxwidth / image.width) * relwidth;
274
+ var relBoxHight = (boxheight / image.height) * relHeight;
275
+ if (relBoxHight > maxHeight) {
276
+ relHeight = maxHeight / (boxheight / image.height);
277
+ relwidth = relHeight / (image.height / image.width);
278
+ relBoxWidth = (boxwidth / image.width) * relwidth;
279
+ relBoxHight = (boxheight / image.height) * relHeight;
280
+ }
281
+
282
+
283
+
284
+ var relBoxLeft = ((boxp.left + conimg.scrollLeft()) / image.width) * relwidth;
285
+ var relBoxTop = ((boxp.top + conimg.scrollTop()) / image.height) * relHeight;
286
+
287
+
288
+
289
+ if (boxwidth > 1 && boxheight > 1) {
290
+ // alert(relwidth+"?"+relHeight)
291
+ $(image).css("width", relwidth + "px");
292
+ $(image).css("height", "auto");
293
+
294
+ $("#part_box").addClass("shadow-lg")
295
+ part_box.css("left", relBoxLeft + "px");
296
+ part_box.css("top", relBoxTop + "px");
297
+ part_box.css("width", relBoxWidth + "px");
298
+ part_box.css("height", relBoxHight + "px");
299
+
300
+ conimg.scrollLeft(relBoxLeft - 10)
301
+ conimg.scrollTop(relBoxTop)
302
+
303
+ // $("#img_contain").scrollLeft(relBoxLeft)
304
+ // $("#img_contain").scrollLeft(relBoxTop)
305
+
306
+ // alert(maxwidth)
307
+ // alert(1)
308
+ }
309
+
310
+
311
+
312
+ }
313
+
314
+ function changeImageMarkSize() {
315
+
316
+ try {
317
+ var rimgw = image_data_object.width;
318
+ var rimgh = image_data_object.height;
319
+
320
+ var cimgw = image.width;
321
+ var cimgh = image.height;
322
+
323
+ //---change box
324
+ if (scope_pos[0] != null && scope_pos[1] != null) {
325
+ var rboxw = scope_pos[1].x - scope_pos[0].x;
326
+ var rboxh = scope_pos[1].y - scope_pos[0].y;
327
+ //计算目标box 的 宽度和高度
328
+ var tboxw = rboxw / (rimgw / cimgw);
329
+ var tboxh = rboxh / (rimgh / cimgh);
330
+ //计算目标box 的 left 和top值
331
+ var tboxleft = scope_pos[0].x / (rimgw / cimgw);
332
+ var tboxtop = scope_pos[0].y / (rimgw / cimgw);
333
+
334
+ part_box.css("left", tboxleft + "px");
335
+ part_box.css("top", tboxtop + "px");
336
+ part_box.css("width", tboxw + "px");
337
+ part_box.css("height", tboxh + "px");
338
+
339
+ if (tboxw > 0 & tboxh > 0) {
340
+ part_box.css("display", "block");
341
+ $(part_box).addClass("shadow-lg");
342
+ }
343
+ }
344
+
345
+
346
+ // alert(scope_pos[0])
347
+
348
+
349
+ gpapi.marks.point.daos.forEach((p, index, arr) => {
350
+ // alert("1")
351
+ // var p = findColorMarks[index];
352
+ var markx = p.x / (rimgw / cimgw);
353
+ var marky = p.y / (rimgw / cimgw);
354
+ // alert(markx+","+marky)
355
+ $('.mark-points').children().eq(index).css({ 'left': markx + "px", 'top': marky + "px" });
356
+ });
357
+
358
+ gpapi.marks.rect.daos.forEach((p, index, arr) => {
359
+ // alert("1")
360
+ // var p = findColorMarks[index];
361
+ var markx = p.rect[0] / (rimgw / cimgw);
362
+ var marky = p.rect[1] / (rimgw / cimgw);
363
+ var w = (p.rect[2] - p.rect[0]) / (rimgw / cimgw);
364
+ var h = (p.rect[3] - p.rect[1]) / (rimgw / cimgw);
365
+ // alert(markx+","+marky)
366
+ $('.mark-rects').children().eq(index).css({ 'left': markx + "px", 'top': marky + "px", 'width': w + "px", 'height': h + "px" });
367
+ });
368
+
369
+
370
+ } catch (error) {
371
+ alert(error)
372
+ }
373
+ }
374
+
375
+
376
+ function showZoomCon(e) {
377
+ // alert($(image).position().left)
378
+ // $(image).posation().x;
379
+ // $(".zoomContainer").fadeIn(200,function(e){
380
+ // // $(".zoomWindow").show();
381
+ // });
382
+
383
+ $(".zoomContainer").show();
384
+
385
+ var pos = mousePos()
386
+
387
+ // var left = image.width+ $(image).position().left +$(".screen-img-container").position().left;
388
+ var left = pos.x + 30
389
+ var conwidth = $("#container_img").width();
390
+ // var top = $("#container_img").position().top;
391
+ var top = pos.y
392
+ // alert(conwidth)
393
+ // if (left > conwidth) {
394
+ // left = conwidth;
395
+ // }
396
+
397
+ var maxHeight = $(window).height() - $(".zoomWindowContainer").height();
398
+
399
+ if(top>maxHeight){
400
+ top = maxHeight
401
+ }
402
+
403
+ // alert(maxHeight)
404
+
405
+ $(".zoomContainer").css('left', left);
406
+ $(".zoomContainer").css('top', top);
407
+
408
+
409
+
410
+ var zoomwindow = $(".zoomWindow");
411
+
412
+ var leftoff = e.x - (zoomwindow.width() / 2);
413
+ leftoff = leftoff * -1;
414
+ // alert(leftoff)
415
+ var topoff = e.y - (zoomwindow.height() / 2);
416
+ topoff = topoff * -1;
417
+
418
+ zoomwindow.css('background-position', `${leftoff}px ${topoff}px`);
419
+
420
+ }
421
+
422
+
423
+
424
+ function init_Image_Mouse() {
425
+ $("#img_preview").mouseup(img_mouseup);
426
+ $("#img_preview").mousedown(img_mousedown);
427
+ $("#img_preview").mousemove(img_mousemove);
428
+ $("#img_preview").mouseout(img_onmouseout);
429
+
430
+
431
+ part_control_c.forEach((element, index) => {
432
+ element.click(function () {
433
+ var dom = part_control_i[index]
434
+ dom.text(Number(dom.text()) - 1)
435
+ var rect = []
436
+ part_control_i.forEach((e, i) => {
437
+ rect.push(Number(e.text()))
438
+ });
439
+ gpapi.image.set_rect(rect,true)
440
+ })
441
+ });
442
+
443
+ part_control_a.forEach((element, index) => {
444
+ element.click(function () {
445
+ var dom = part_control_i[index]
446
+ dom.text(Number(dom.text()) + 1)
447
+ var rect = []
448
+ part_control_i.forEach((e, i) => {
449
+ rect.push(Number(e.text()))
450
+ });
451
+ gpapi.image.set_rect(rect,true)
452
+ })
453
+ });
454
+
455
+ $(".p_b_copy").click(function () {
456
+ var rect = []
457
+ part_control_i.forEach((e, i) => {
458
+ rect.push(Number(e.text()))
459
+ });
460
+
461
+ gpapi.sys.copy(rect.join(","))
462
+ })
463
+ }
464
+