eedatek-electron-screenrecord 2.1.2 → 2.1.4

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 (2) hide show
  1. package/lib/index.js +4 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -55,6 +55,7 @@ class ScreenRecord extends events_1.default {
55
55
  //更新开始、结束录屏按钮区域
56
56
  updateButtonBounds(bounds) {
57
57
  this.logger(`updateButtonBounds x:${bounds.x} y:${bounds.y} w:${bounds.width} h:${bounds.height}`);
58
+ this.isRecording = true;
58
59
  this.buttonBounds = bounds;
59
60
  }
60
61
  startMouseTracking() {
@@ -67,6 +68,7 @@ class ScreenRecord extends events_1.default {
67
68
  // const mousePos = screen.getCursorScreenPoint();
68
69
  const mousePos = robot.getMousePos();
69
70
  const winBounds = this.$win?.getBounds();
71
+ // console.log(`mousePos: x:${mousePos.x} y: ${mousePos.y}`);
70
72
  // 计算鼠标是否在按钮区域内
71
73
  const isInButtonArea = this.isMouseInButtonArea(mousePos, winBounds);
72
74
  if (isInButtonArea) {
@@ -107,6 +109,7 @@ class ScreenRecord extends events_1.default {
107
109
  */
108
110
  async startCapture() {
109
111
  this.logger("startCapture");
112
+ this.reset();
110
113
  const display = (0, getDisplay_1.default)();
111
114
  //全屏的截图base64
112
115
  const [imageUrl] = await Promise.all([this.capture(display)]);
@@ -231,6 +234,7 @@ class ScreenRecord extends events_1.default {
231
234
  // })
232
235
  this.$win.on("closed", () => {
233
236
  this.emit("windowClosed", this.$win);
237
+ this.isRecording = false;
234
238
  this.$win = null;
235
239
  this.stopMouseTracking();
236
240
  });
@@ -355,7 +359,6 @@ class ScreenRecord extends events_1.default {
355
359
  this.logger("callback SCREENRECORD:ok");
356
360
  this.$win?.setIgnoreMouseEvents(true, { forward: true });
357
361
  if (process.platform !== "win32") {
358
- this.isRecording = true;
359
362
  this.startMouseTracking();
360
363
  }
361
364
  });
@@ -370,7 +373,6 @@ class ScreenRecord extends events_1.default {
370
373
  * CANCEL事件
371
374
  */
372
375
  electron_1.ipcMain.on("SCREENRECORD:cancel", () => {
373
- this.isRecording = false;
374
376
  this.logger("callback SCREENRECORD:cancel");
375
377
  this.$win?.setIgnoreMouseEvents(false);
376
378
  if (process.platform !== "win32") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eedatek-electron-screenrecord",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "electron 录屏插件",
5
5
  "types": "lib/index.d.ts",
6
6
  "main": "lib/index.cjs.js",