mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
Move selrect into separate ns and rename it to mouse-selrect.
This commit is contained in:
parent
89cc964f54
commit
d5bc6bb16a
2 changed files with 31 additions and 21 deletions
|
@ -16,6 +16,7 @@
|
|||
[uxbox.ui.mixins :as mx]
|
||||
[uxbox.ui.dom :as dom]
|
||||
[uxbox.ui.workspace.base :as wb]
|
||||
[uxbox.ui.workspace.selrect :refer (mouse-selrect)]
|
||||
[uxbox.ui.workspace.grid :refer (grid)]
|
||||
[uxbox.ui.workspace.options :refer (element-opts)])
|
||||
(:import goog.events.EventType))
|
||||
|
@ -44,27 +45,6 @@
|
|||
:name "background"
|
||||
:mixins [mx/static]}))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Select Rect
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn selrect-render
|
||||
[own]
|
||||
(when-let [data (rum/react wb/selrect-pos)]
|
||||
(let [{:keys [x y width height]} (wb/selrect->rect data)]
|
||||
(html
|
||||
[:rect.selection-rect
|
||||
{:x x
|
||||
:y y
|
||||
:width width
|
||||
:height height}]))))
|
||||
|
||||
(def ^:static selrect
|
||||
(mx/component
|
||||
{:render selrect-render
|
||||
:name "selrect"
|
||||
:mixins [mx/static rum/reactive]}))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Selected shapes.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
30
src/uxbox/ui/workspace/selrect.cljs
Normal file
30
src/uxbox/ui/workspace/selrect.cljs
Normal file
|
@ -0,0 +1,30 @@
|
|||
(ns uxbox.ui.workspace.selrect
|
||||
"Components for indicate the user selection and selected shapes group."
|
||||
(:require [sablono.core :as html :refer-macros [html]]
|
||||
[rum.core :as rum]
|
||||
[beicon.core :as rx]
|
||||
[cats.labs.lens :as l]
|
||||
[uxbox.rstore :as rs]
|
||||
[uxbox.state :as st]
|
||||
[uxbox.shapes :as sh]
|
||||
[uxbox.ui.workspace.base :as wb]
|
||||
[uxbox.ui.mixins :as mx]
|
||||
[uxbox.ui.dom :as dom]))
|
||||
|
||||
(defn mouse-selrect-render
|
||||
[own]
|
||||
(when-let [data (rum/react wb/selrect-pos)]
|
||||
(let [{:keys [x y width height]} (wb/selrect->rect data)]
|
||||
(html
|
||||
[:rect.selection-rect
|
||||
{:x x
|
||||
:y y
|
||||
:width width
|
||||
:height height}]))))
|
||||
|
||||
(def ^:static mouse-selrect
|
||||
(mx/component
|
||||
{:render mouse-selrect-render
|
||||
:name "mouse-selrect"
|
||||
:mixins [mx/static rum/reactive]}))
|
||||
|
Loading…
Add table
Reference in a new issue