wails icon indicating copy to clipboard operation
wails copied to clipboard

OffscreenCanvas support

Open Niceadam opened this issue 1 year ago • 4 comments

Description

Hello! I sincerely want to thank you for this incredible project and the incredible quality of maintenance. You're doing very important work

I am using AG Charts for my application which uses OffscreenCanvas, I get a ReferenceError. Testing with a clean slate SvelteKit project seems to confirm it, maybe i missed some configuration or I invoked some problem? WebKitGTK seems to support it by default by v2.45.3 but thats all I found.

To Reproduce

  1. New SvelteKit project
  2. new OffscreenCanvas() can't be found

Expected behaviour

No error

Screenshots

No response

Attempted Fixes

Added @types/offscreencanvas and tsconfig entry. Didn't work

System Details

# Wails
Version         | v2.9.1
Package Manager | pacman

# System
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Arch Linux                                                                                                         |
| Version      | Unknown                                                                                                            |
| ID           | arch                                                                                                               |
| Go Version   | go1.22.3                                                                                                           |
| Platform     | linux                                                                                                              |
| Architecture | amd64                                                                                                              |
| CPU          | AMD Ryzen 5 5600H with Radeon Graphics                                                                             |
| GPU 1        | Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (Advanced Micro Devices, Inc. [AMD/ATI]) - Driver: amdgpu |
| GPU 2        | GA106M [GeForce RTX 3060 Mobile / Max-Q] (NVIDIA Corporation) - Driver: nvidia                                     |
| Memory       | 14GB                                                                                                               |
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version                   |
| *docker    | docker       | Installed | 1:27.0.3-1                |
| gcc        | gcc          | Installed | 14.1.1+r58+gfc9fb69ad62-1 |
| libgtk-3   | gtk3         | Installed | 1:3.24.43-1               |
| libwebkit  | webkit2gtk   | Installed | 2.44.2-1                  |
| npm        | npm          | Installed | 10.8.2-1                  |
| pkg-config | pkgconf      | Installed | 2.1.1-1                   |
└───────────────────── * - Optional Dependency ─────────────────────┘

Additional context

No response

Niceadam avatar Jul 24 '24 00:07 Niceadam

Do you realise you wrote

WebKitGTK seems to support it by default by v2.45.3

(Note: 2.45.4 release enable offscreen canvas by default in production builds too.)

But you're using webkit2gtk | Installed | 2.44.2-1

nickolasgregory avatar Jul 27 '24 08:07 nickolasgregory

Yes, I assumed that the support was there, just not activated by default (not a smart thought now that I think about it). I will try upgrading the version

Niceadam avatar Jul 27 '24 14:07 Niceadam

@Niceadam how did you go?

leaanthony avatar Aug 18 '24 11:08 leaanthony

I ended up just using a polyfill instead

if (!window.OffscreenCanvas) {
  window.OffscreenCanvas = class OffscreenCanvas {
    constructor(width, height) {
      this.canvas = document.createElement("canvas");
      this.canvas.width = width;
      this.canvas.height = height;
      return this.canvas;
    }
  };
}

Niceadam avatar Aug 18 '24 15:08 Niceadam