mirror of
https://github.com/penpot/penpot.git
synced 2025-02-24 15:56:11 -05:00
Cosmetic changes on rect shapes components.
This commit is contained in:
parent
a0e261403b
commit
5b995f78aa
1 changed files with 8 additions and 15 deletions
|
@ -5,9 +5,7 @@
|
||||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||||
|
|
||||||
(ns uxbox.main.ui.shapes.rect
|
(ns uxbox.main.ui.shapes.rect
|
||||||
(:require [sablono.core :refer-macros [html]]
|
(:require [uxbox.main.ui.shapes.common :as common]
|
||||||
[rum.core :as rum]
|
|
||||||
[uxbox.main.ui.shapes.common :as common]
|
|
||||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||||
[uxbox.util.mixins :as mx :include-macros true]
|
[uxbox.util.mixins :as mx :include-macros true]
|
||||||
[uxbox.main.geom :as geom]
|
[uxbox.main.geom :as geom]
|
||||||
|
@ -17,26 +15,21 @@
|
||||||
|
|
||||||
(declare rect-shape)
|
(declare rect-shape)
|
||||||
|
|
||||||
(defn- rect-component-render
|
(mx/defc rect-component
|
||||||
[own shape]
|
{:mixins [mx/reactive mx/static]}
|
||||||
|
[shape]
|
||||||
(let [{:keys [id x y width height group]} shape
|
(let [{:keys [id x y width height group]} shape
|
||||||
selected (mx/react common/selected-ref)
|
selected (mx/react common/selected-ref)
|
||||||
selected? (contains? selected id)
|
selected? (contains? selected id)
|
||||||
on-mouse-down #(common/on-mouse-down % shape selected)]
|
on-mouse-down #(common/on-mouse-down % shape selected)]
|
||||||
(html
|
[:g.shape {:class (when selected? "selected")
|
||||||
[:g.shape {:class (when selected? "selected")
|
:on-mouse-down on-mouse-down}
|
||||||
:on-mouse-down on-mouse-down}
|
(rect-shape shape identity)]))
|
||||||
(rect-shape shape identity)])))
|
|
||||||
|
|
||||||
(def rect-component
|
|
||||||
(mx/component
|
|
||||||
{:render rect-component-render
|
|
||||||
:name "rect-component"
|
|
||||||
:mixins [mx/static mx/reactive]}))
|
|
||||||
|
|
||||||
;; --- Rect Shape
|
;; --- Rect Shape
|
||||||
|
|
||||||
(mx/defc rect-shape
|
(mx/defc rect-shape
|
||||||
|
{:mixins [mx/static]}
|
||||||
[{:keys [id x1 y1] :as shape}]
|
[{:keys [id x1 y1] :as shape}]
|
||||||
(let [key (str "shape-" id)
|
(let [key (str "shape-" id)
|
||||||
rfm (geom/transformation-matrix shape)
|
rfm (geom/transformation-matrix shape)
|
||||||
|
|
Loading…
Add table
Reference in a new issue