@netless/window-manager 0.4.52 → 0.4.53
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/CHANGELOG.md +4 -0
- package/dist/Cursor/index.d.ts +3 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +18 -12
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/Cursor/index.ts +18 -11
package/package.json
CHANGED
package/src/Cursor/index.ts
CHANGED
@@ -3,7 +3,6 @@ import { Cursor } from "./Cursor";
|
|
3
3
|
import { CursorState, Events } from "../constants";
|
4
4
|
import { emitter } from "../InternalEmitter";
|
5
5
|
import { SideEffectManager } from "side-effect-manager";
|
6
|
-
import { throttle } from "lodash";
|
7
6
|
import { WindowManager } from "../index";
|
8
7
|
import type { CursorMovePayload, ApplianceIcons } from "../index";
|
9
8
|
import type { PositionType } from "../AttributesDelegate";
|
@@ -106,15 +105,27 @@ export class CursorManager {
|
|
106
105
|
return this.manager.focusApp?.view;
|
107
106
|
}
|
108
107
|
|
109
|
-
private
|
110
|
-
const isTouch = event.pointerType === "touch";
|
111
|
-
if (isTouch) {
|
112
|
-
if (!event.isPrimary) return;
|
113
|
-
}
|
108
|
+
private mouseMoveListener_ = (event: PointerEvent, isTouch: boolean) => {
|
114
109
|
const type = this.getType(event);
|
115
110
|
this.updateCursor(type, event.clientX, event.clientY);
|
116
111
|
isTouch && this.showPencilEraserIfNeeded(type, event.clientX, event.clientY);
|
117
|
-
}
|
112
|
+
}
|
113
|
+
|
114
|
+
private mouseMoveTimer = 0;
|
115
|
+
private mouseMoveListener = (event: PointerEvent) => {
|
116
|
+
const isTouch = event.pointerType === "touch";
|
117
|
+
if (isTouch && !event.isPrimary) return;
|
118
|
+
|
119
|
+
const now = Date.now()
|
120
|
+
if (now - this.mouseMoveTimer > 48) {
|
121
|
+
this.mouseMoveTimer = now;
|
122
|
+
this.mouseMoveListener_(event, isTouch);
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
private mouseLeaveListener = () => {
|
127
|
+
this.hideCursor(this.manager.uid);
|
128
|
+
}
|
118
129
|
|
119
130
|
private showPencilEraserIfNeeded(event: EventType, clientX: number, clientY: number) {
|
120
131
|
const self = findMemberByUid(this.manager.room, this.manager.uid);
|
@@ -187,10 +198,6 @@ export class CursorManager {
|
|
187
198
|
}
|
188
199
|
};
|
189
200
|
|
190
|
-
private mouseLeaveListener = () => {
|
191
|
-
this.hideCursor(this.manager.uid);
|
192
|
-
};
|
193
|
-
|
194
201
|
public updateContainerRect() {
|
195
202
|
this.containerRect = WindowManager.container?.getBoundingClientRect();
|
196
203
|
this.wrapperRect = WindowManager.wrapper?.getBoundingClientRect();
|