@buncanvas/core 0.1.7 → 0.2.0

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/index.js CHANGED
@@ -324,6 +324,10 @@ var lib = dlopen(dlPath, {
324
324
  args: ["ptr"],
325
325
  returns: "void"
326
326
  },
327
+ canvas_destroy_all: {
328
+ args: [],
329
+ returns: "void"
330
+ },
327
331
  image_create: {
328
332
  args: [],
329
333
  returns: "ptr"
@@ -3024,29 +3028,6 @@ class Window {
3024
3028
  item.cb(evt);
3025
3029
  });
3026
3030
  }
3027
- if (this.#mMoveViewer[0] != 0) {
3028
- this.#mMoveViewer[0] = 0;
3029
- const evt = new MouseEvent("move", {
3030
- target: this,
3031
- altKey: false,
3032
- button: 0,
3033
- buttons: this.#mMoveViewer[5],
3034
- clientX: this.#mMoveViewer[1],
3035
- clientY: this.#mMoveViewer[2],
3036
- movementX: this.#mMoveViewer[3],
3037
- movementY: this.#mMoveViewer[4],
3038
- ctrlKey: false,
3039
- metaKey: false,
3040
- screenX: 0,
3041
- screenY: 0,
3042
- shiftKey: false
3043
- });
3044
- if (this.onmousemove)
3045
- this.onmousemove(evt);
3046
- this.#mMoveEvts.forEach((item, key) => {
3047
- item.cb(evt);
3048
- });
3049
- }
3050
3031
  if (this.#mDownViewer[0] != 0) {
3051
3032
  this.#mDownViewer[0] = 0;
3052
3033
  const evt = new MouseEvent("down", {
@@ -3212,10 +3193,14 @@ class Window {
3212
3193
  nativePath: dlPath
3213
3194
  });
3214
3195
  let pendingFrame = false;
3196
+ let shuttingDown = false;
3215
3197
  let lastFrame = performance.now();
3216
3198
  render_thread.onmessage = (msg) => {
3217
3199
  const frameSignal = msg.data;
3218
3200
  if (frameSignal == 2) {
3201
+ if (shuttingDown)
3202
+ return;
3203
+ shuttingDown = true;
3219
3204
  lib.symbols.destroy_window();
3220
3205
  lib.symbols.images_cleanup();
3221
3206
  process.exit(0);
@@ -3234,7 +3219,6 @@ class Window {
3234
3219
  }
3235
3220
  if (!pendingFrame) {
3236
3221
  pendingFrame = true;
3237
- lib.symbols.canvas_flush_gpu();
3238
3222
  setImmediate(() => {
3239
3223
  const queueLen = requestedFrames.length;
3240
3224
  if (queueLen > 0) {
@@ -3244,6 +3228,7 @@ class Window {
3244
3228
  framesToProcess[i](now);
3245
3229
  }
3246
3230
  }
3231
+ lib.symbols.canvas_flush_gpu();
3247
3232
  pendingFrame = false;
3248
3233
  });
3249
3234
  }
@@ -290,6 +290,10 @@ export declare const lib: import("bun:ffi").Library<{
290
290
  args: "ptr"[];
291
291
  returns: "void";
292
292
  };
293
+ canvas_destroy_all: {
294
+ args: never[];
295
+ returns: "void";
296
+ };
293
297
  image_create: {
294
298
  args: never[];
295
299
  returns: "ptr";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@buncanvas/core",
3
3
  "module": "index.js",
4
4
  "type": "module",
5
- "version": "0.1.7",
5
+ "version": "0.2.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -13,13 +13,14 @@
13
13
  "typescript": "^7"
14
14
  },
15
15
  "optionalDependencies": {
16
- "@buncanvas/native-linux-x64": "0.1.7",
17
- "@buncanvas/native-win32-x64": "0.1.7",
18
- "@buncanvas/native-darwin-x64": "0.1.7"
16
+ "@buncanvas/native-linux-x64": "0.2.0",
17
+ "@buncanvas/native-win32-x64": "0.2.0",
18
+ "@buncanvas/native-darwin-x64": "0.2.0"
19
19
  },
20
20
  "keywords": [
21
21
  "canvas",
22
22
  "gpu",
23
+ "vulkan",
23
24
  "window",
24
25
  "frontend",
25
26
  "graphic",