mirror of
https://github.com/penpot/penpot.git
synced 2025-06-19 08:21:38 +02:00
Merge pull request #5325 from penpot/niwinz-uuid-tweaks
✨ Improve Uint32 array generation from uuid
This commit is contained in:
commit
4e28f1b1f7
6 changed files with 157 additions and 73 deletions
|
@ -27,13 +27,13 @@
|
|||
|
||||
(defn create-shape
|
||||
[id]
|
||||
(let [buffer (uuid/uuid->u32 id)
|
||||
(let [buffer (uuid/get-u32 id)
|
||||
create-shape (unchecked-get internal-module "_create_shape")]
|
||||
(^function create-shape (aget buffer 0) (aget buffer 1) (aget buffer 2) (aget buffer 3))))
|
||||
|
||||
(defn use-shape
|
||||
[id]
|
||||
(let [buffer (uuid/uuid->u32 id)
|
||||
(let [buffer (uuid/get-u32 id)
|
||||
use-shape (unchecked-get internal-module "_use_shape")]
|
||||
(^function use-shape (aget buffer 0) (aget buffer 1) (aget buffer 2) (aget buffer 3))))
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
add-shape-child (unchecked-get internal-module "_add_shape_child")]
|
||||
(^function clear-shape-children)
|
||||
(doseq [id shape_ids]
|
||||
(let [buffer (uuid/uuid->u32 id)]
|
||||
(let [buffer (uuid/get-u32 id)]
|
||||
(^function add-shape-child (aget buffer 0) (aget buffer 1) (aget buffer 2) (aget buffer 3))))))
|
||||
|
||||
(defn set-shape-fills
|
||||
|
|
|
@ -61,14 +61,16 @@
|
|||
(cancel-idle-callback sem))))))
|
||||
|
||||
(def ^:private request-animation-frame
|
||||
(or (and (exists? js/window) (.-requestAnimationFrame js/window))
|
||||
#(js/setTimeout % 16)))
|
||||
(if (and (exists? js/globalThis)
|
||||
(exists? (.-requestAnimationFrame js/globalThis)))
|
||||
#(.requestAnimationFrame js/globalThis %)
|
||||
#(js/setTimeout % 16)))
|
||||
|
||||
(defn raf
|
||||
[f]
|
||||
(request-animation-frame f))
|
||||
(^function request-animation-frame f))
|
||||
|
||||
(defn idle-then-raf
|
||||
[f]
|
||||
(schedule-on-idle #(raf f)))
|
||||
(schedule-on-idle #(^function raf f)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue