Fix many inconsistencies between drawing and resizing.

This enables sharing code between the drawing logic and
the simple resizing. Allowing drawing in any direction,
not only from top-left to bottom-right.

Fixes issue #44.
This commit is contained in:
Andrey Antukh 2017-02-27 20:23:51 +01:00
parent b7253b7fd5
commit f82ddac72d
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
16 changed files with 291 additions and 321 deletions

View file

@ -8,11 +8,12 @@
(:require [beicon.core :as rx]
[lentes.core :as l]
[potok.core :as ptk]
[uxbox.main.geom :as geom]
[uxbox.main.refs :as refs]
[uxbox.main.store :as st]
[uxbox.main.ui.shapes.common :as common]
[uxbox.main.ui.shapes.attrs :as attrs]
[uxbox.main.data.images :as udi]
[uxbox.main.geom :as geom]
[uxbox.util.mixins :as mx :include-macros true]
[uxbox.util.geom.matrix :as gmt]))
@ -36,8 +37,8 @@
(st/emit! (udi/fetch-image id)))
own)}
[own {:keys [id image] :as shape}]
(let [modifiers (mx/react (common/modifiers-ref id))
selected (mx/react common/selected-ref)
(let [modifiers (mx/react (refs/selected-modifiers id))
selected (mx/react refs/selected-shapes)
image (mx/react (image-ref image))
selected? (contains? selected id)
on-mouse-down #(common/on-mouse-down % shape selected)