mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 18:48:37 -05:00
Fix selrect and options positions for groped shapes.
This commit is contained in:
parent
eabee221b6
commit
3bda4f6de3
2 changed files with 9 additions and 6 deletions
|
@ -2,7 +2,8 @@
|
|||
(:require [sablono.core :as html :refer-macros [html]]
|
||||
[rum.core :as rum]
|
||||
[uxbox.rstore :as rs]
|
||||
[uxbox.shapes :as shapes]
|
||||
[uxbox.state :as st]
|
||||
[uxbox.shapes :as sh]
|
||||
[uxbox.data.workspace :as dw]
|
||||
[uxbox.ui.icons :as i]
|
||||
[uxbox.ui.mixins :as mx]
|
||||
|
@ -28,16 +29,17 @@
|
|||
:icon i/fill
|
||||
:id :menu/fill}})
|
||||
|
||||
(defn viewportcoord->clientcoord
|
||||
(defn- viewportcoord->clientcoord
|
||||
[pageid viewport-x viewport-y]
|
||||
(let [[offset-x offset-y] (get @wb/bounding-rect pageid)
|
||||
new-x (+ viewport-x offset-x)
|
||||
new-y (+ viewport-y offset-y)]
|
||||
[new-x new-y]))
|
||||
|
||||
(defn get-position
|
||||
[{:keys [x y width page]}]
|
||||
(let [vx (+ x width 50)
|
||||
(defn- get-position
|
||||
[{:keys [page width] :as shape}]
|
||||
(let [{:keys [x y]} (sh/resolve-position shape)
|
||||
vx (+ x width 50)
|
||||
vy (- y 50)]
|
||||
(viewportcoord->clientcoord page vx vy)))
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
(defn shapes-selrect-render
|
||||
[own shapes]
|
||||
(when (seq shapes)
|
||||
(let [{:keys [width height x y]} (sh/group-size-and-position shapes)]
|
||||
(let [shapes (map sh/resolve-position shapes)
|
||||
{:keys [width height x y]} (sh/group-size-and-position shapes)]
|
||||
(html
|
||||
[:g.controls
|
||||
[:rect {:x x :y y :width width :height height
|
||||
|
|
Loading…
Add table
Reference in a new issue