electron-screenshots 0.0.17 → 0.1.3
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.
- package/lib/getBoundAndDisplay.js +11 -8
- package/package.json +3 -3
|
@@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var electron_1 = require("electron");
|
|
4
4
|
exports.default = (function () {
|
|
5
5
|
var point = electron_1.screen.getCursorScreenPoint();
|
|
6
|
-
var _a = electron_1.screen.getDisplayNearestPoint(point), id = _a.id, bounds = _a.bounds, workArea = _a.workArea
|
|
6
|
+
var _a = electron_1.screen.getDisplayNearestPoint(point), id = _a.id, bounds = _a.bounds, workArea = _a.workArea;
|
|
7
|
+
var keys = ['x', 'y', 'width', 'height'];
|
|
8
|
+
// https://github.com/nashaofu/screenshots/issues/98
|
|
9
|
+
keys.forEach(function (key) {
|
|
10
|
+
bounds[key] = Math.floor(bounds[key]);
|
|
11
|
+
workArea[key] = Math.floor(workArea[key]);
|
|
12
|
+
});
|
|
7
13
|
// win32 darwin linux平台分别处理
|
|
8
14
|
var display = process.platform === 'linux' ? workArea : bounds;
|
|
9
|
-
// mac图片太大,导致截图窗口卡顿,并且截图窗口显示延迟很严重
|
|
10
|
-
var scale = process.platform === 'darwin' ? 2 : scaleFactor;
|
|
11
|
-
scale = scale < 2 ? 2 : scale;
|
|
12
15
|
return {
|
|
13
16
|
bound: {
|
|
14
17
|
x: bounds.x,
|
|
@@ -18,10 +21,10 @@ exports.default = (function () {
|
|
|
18
21
|
},
|
|
19
22
|
display: {
|
|
20
23
|
id: id,
|
|
21
|
-
x: display.x
|
|
22
|
-
y: display.y
|
|
23
|
-
width: display.width
|
|
24
|
-
height: display.height
|
|
24
|
+
x: display.x,
|
|
25
|
+
y: display.y,
|
|
26
|
+
width: display.width,
|
|
27
|
+
height: display.height
|
|
25
28
|
}
|
|
26
29
|
};
|
|
27
30
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-screenshots",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "electron 截图插件",
|
|
5
5
|
"types": "lib/screenshots.d.ts",
|
|
6
6
|
"main": "lib/screenshots.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"registry": "https://registry.npmjs.org/"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"react-screenshots": "^0.
|
|
38
|
+
"react-screenshots": "^0.1.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"electron": ">=8"
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"rimraf": "^3.0.2",
|
|
55
55
|
"typescript": "^4.2.4"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "ee4ca916f6249dc78ef02fc71c9d93f72c745855"
|
|
58
58
|
}
|