0
Fork 0
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:
Andrey Antukh 2016-01-19 17:05:48 +02:00
parent 89cc964f54
commit d5bc6bb16a
2 changed files with 31 additions and 21 deletions

View file

@ -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.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View 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]}))