mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 20:56:38 +02:00
🎉 Add debug options to wasm
This commit is contained in:
parent
b332f128b0
commit
f564b4e66d
3 changed files with 14 additions and 3 deletions
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
[:div {:class (stl/css :debug-panel-inner)}
|
[:div {:class (stl/css :debug-panel-inner)}
|
||||||
(for [option (sort-by d/name dbg/options)]
|
(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))
|
[:span {:class (stl/css-case :checkbox-icon true :global/checked (dbg/enabled? option))
|
||||||
:on-click #(on-toggle-enabled % option)}
|
:on-click #(on-toggle-enabled % option)}
|
||||||
(when (dbg/enabled? option) i/status-tick)]
|
(when (dbg/enabled? option) i/status-tick)]
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.render-wasm.helpers :as h]
|
[app.render-wasm.helpers :as h]
|
||||||
|
[app.util.debug :as dbg]
|
||||||
[app.util.functions :as fns]
|
[app.util.functions :as fns]
|
||||||
[app.util.http :as http]
|
[app.util.http :as http]
|
||||||
[app.util.webapi :as wapi]
|
[app.util.webapi :as wapi]
|
||||||
|
@ -279,9 +280,16 @@
|
||||||
[width height]
|
[width height]
|
||||||
(h/call internal-module "_resize_viewbox" 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
|
(defn assign-canvas
|
||||||
[canvas]
|
[canvas]
|
||||||
(let [gl (unchecked-get internal-module "GL")
|
(let [gl (unchecked-get internal-module "GL")
|
||||||
|
flags (debug-flags)
|
||||||
context (.getContext ^js canvas "webgl2" canvas-options)
|
context (.getContext ^js canvas "webgl2" canvas-options)
|
||||||
|
|
||||||
;; Register the context with emscripten
|
;; Register the context with emscripten
|
||||||
|
@ -290,7 +298,7 @@
|
||||||
|
|
||||||
;; Initialize Wasm Render Engine
|
;; Initialize Wasm Render Engine
|
||||||
(h/call internal-module "_init" (/ (.-width ^js canvas) dpr) (/ (.-height ^js canvas) dpr))
|
(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! (.-width canvas) (* dpr (.-clientWidth ^js canvas)))
|
||||||
(set! (.-height canvas) (* dpr (.-clientHeight ^js canvas))))
|
(set! (.-height canvas) (* dpr (.-clientHeight ^js canvas))))
|
||||||
|
|
|
@ -92,7 +92,10 @@
|
||||||
:bool-shapes
|
:bool-shapes
|
||||||
|
|
||||||
;; Show some information about the WebGL context.
|
;; Show some information about the WebGL context.
|
||||||
:gl-context})
|
:gl-context
|
||||||
|
|
||||||
|
;; Show viewbox
|
||||||
|
:wasm-viewbox})
|
||||||
|
|
||||||
(defn enable!
|
(defn enable!
|
||||||
[option]
|
[option]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue