mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 14:39:45 -05:00
fix zoom drawing glitch (rust)
This commit is contained in:
parent
80bbfe7a6f
commit
305de33200
2 changed files with 9 additions and 9 deletions
|
@ -281,9 +281,9 @@
|
|||
(swap! canvas-set? true))))))
|
||||
;; redraw when vbox or shapes change
|
||||
(mf/with-effect
|
||||
[vbox' base-objects canvas-set? zoom]
|
||||
[vbox base-objects canvas-set? zoom]
|
||||
(when @canvas-set?
|
||||
(render-v2/draw-canvas vbox' zoom base-objects))))
|
||||
(render-v2/draw-canvas vbox zoom base-objects))))
|
||||
|
||||
(hooks/setup-dom-events zoom disable-paste in-viewport? workspace-read-only? drawing-tool drawing-path?)
|
||||
(hooks/setup-viewport-size vport viewport-ref)
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
reset-canvas (gobj/get ^js internal-module "_reset_canvas")
|
||||
scale (gobj/get ^js internal-module "_scale")]
|
||||
|
||||
(reset-canvas gpu-state)
|
||||
(scale gpu-state zoom zoom)
|
||||
(translate gpu-state (- (:x vbox)) (- (:y vbox)))
|
||||
(doseq [shape (vals objects)]
|
||||
(let [sr (:selrect shape)]
|
||||
(println "*****" (:x1 sr) (:y1 sr) (:x2 sr) (:y2 sr))
|
||||
(draw-rect gpu-state (:x1 sr) (:y1 sr) (:x2 sr) (:y2 sr))))))
|
||||
(js/requestAnimationFrame (fn [])
|
||||
(reset-canvas gpu-state)
|
||||
(scale gpu-state zoom zoom)
|
||||
(translate gpu-state (- (:x vbox)) (- (:y vbox)))
|
||||
(doseq [shape (vals objects)]
|
||||
(let [sr (:selrect shape)]
|
||||
(draw-rect gpu-state (:x1 sr) (:y1 sr) (:x2 sr) (:y2 sr)))))))
|
||||
|
||||
(defn set-canvas
|
||||
[canvas vbox zoom objects]
|
||||
|
|
Loading…
Add table
Reference in a new issue