0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

🎉 Add debug options to wasm

This commit is contained in:
AzazelN28 2024-11-26 15:22:53 +01:00 committed by Belén Albeza
parent b332f128b0
commit f564b4e66d
3 changed files with 14 additions and 3 deletions

View file

@ -43,7 +43,7 @@
[:div {:class (stl/css :debug-panel-inner)}
(for [option (sort-by d/name dbg/options)]
[:div {:class (stl/css :checkbox-wrapper)}
[:div {:key (d/name option) :class (stl/css :checkbox-wrapper)}
[:span {:class (stl/css-case :checkbox-icon true :global/checked (dbg/enabled? option))
:on-click #(on-toggle-enabled % option)}
(when (dbg/enabled? option) i/status-tick)]

View file

@ -12,6 +12,7 @@
[app.common.uuid :as uuid]
[app.config :as cf]
[app.render-wasm.helpers :as h]
[app.util.debug :as dbg]
[app.util.functions :as fns]
[app.util.http :as http]
[app.util.webapi :as wapi]
@ -279,9 +280,16 @@
[width height]
(h/call internal-module "_resize_viewbox" width height))
(defn- debug-flags
[]
(let [debug-options 0]
(when (dbg/enabled? :wasm-viewbox)
(bit-or debug-options 2r00000000000000000000000000000001))))
(defn assign-canvas
[canvas]
(let [gl (unchecked-get internal-module "GL")
flags (debug-flags)
context (.getContext ^js canvas "webgl2" canvas-options)
;; Register the context with emscripten
@ -290,7 +298,7 @@
;; Initialize Wasm Render Engine
(h/call internal-module "_init" (/ (.-width ^js canvas) dpr) (/ (.-height ^js canvas) dpr))
(h/call internal-module "_set_render_options" 0x01 dpr))
(h/call internal-module "_set_render_options" flags dpr))
(set! (.-width canvas) (* dpr (.-clientWidth ^js canvas)))
(set! (.-height canvas) (* dpr (.-clientHeight ^js canvas))))

View file

@ -92,7 +92,10 @@
:bool-shapes
;; Show some information about the WebGL context.
:gl-context})
:gl-context
;; Show viewbox
:wasm-viewbox})
(defn enable!
[option]