Belén Albeza 0639ca53de
Implement WebGL context restoring (#9317)
*  Implement asset re-uploading to wasm

*  Show toast instead of error screen when webgl context is lost

* 🎉 Recover context after webgl context restored event

* 🎉 Set Read-only mode when the context has been lost

*  Disable scroll & zoom when context loss

*  Fix stale reload payload

*  Use existing debounce util to take screenshots

*  Implement design / ux specs

*  Fix playwright test by looking for toast, not error page
2026-05-11 13:15:45 +02:00

30 lines
1.1 KiB
Clojure

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.render-wasm.gesture
"WASM-linked pointer gestures (interactive transforms, like D&D)")
(defonce ^:private interactive-transform-active? (atom false))
(defn reset-after-wasm-reload!
"Call after `_clean_up` + `_init` (new GL context). WASM interactive_transform /
fast_mode are reset to defaults; this atom must match or compare-and-set helpers in
modifiers.cljs will skip `_set_modifiers_start` / `_set_modifiers_end` incorrectly."
[]
(reset! interactive-transform-active? false))
(defn try-begin-interactive-transform!
"Returns true iff we transitioned inactive → active and native `_set_modifiers_start`
must run."
[]
(compare-and-set! interactive-transform-active? false true))
(defn try-end-interactive-transform!
"Returns true iff we transitioned active → inactive and native `_set_modifiers_end`
must run."
[]
(compare-and-set! interactive-transform-active? true false))