0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-05 03:21:26 -05:00

Remove line draw tool and line shape support.

The path support is superset of line and it
just replaces the line functionality.
This commit is contained in:
Andrey Antukh 2016-08-24 16:43:45 +03:00
parent 1693d172bd
commit 3d18f2d95e
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
6 changed files with 0 additions and 82 deletions

View file

@ -17,7 +17,6 @@
(derive ::rect ::shape)
(derive :icon ::rect)
(derive :rect ::rect)
(derive :line ::shape)
(derive :circle ::shape)
(derive :text ::rect)
(derive :group ::rect)))
@ -41,7 +40,6 @@
:icon (move-rect shape dpoint)
:rect (move-rect shape dpoint)
:text (move-rect shape dpoint)
:line (move-rect shape dpoint)
:path (move-path shape dpoint)
;; :path (move-rect shape dpoint)
:circle (move-circle shape dpoint)
@ -95,7 +93,6 @@
(case (:type shape)
:icon (absolute-move-rect shape point)
:rect (absolute-move-rect shape point)
:line (absolute-move-rect shape point)
:circle (absolute-move-circle shape point)
:group (absolute-move-group shape point)))
@ -142,7 +139,6 @@
:text (rect-size shape)
:rect (rect-size shape)
:icon (rect-size shape)
:line (rect-size shape)
:path (rect-size shape)))
(defn- rect-size
@ -258,7 +254,6 @@
;; --- Resize (Absolute)
(declare resize-rect)
(declare resize-line)
(declare resize-circle)
(declare normalize-shape)
(declare equalize-sides)
@ -271,7 +266,6 @@
:rect (resize-rect shape point)
:icon (resize-rect shape point)
:text (resize-rect shape point)
:line (resize-line shape point)
:path (resize-rect shape point)
:circle (resize-circle shape point)))
@ -298,12 +292,6 @@
(assoc shape :rx rx :ry rx)
(assoc shape :rx rx :ry ry))))
(defn- resize-line
"A specialized function for absolute resize
for line shapes."
[shape {:keys [x y] :as pos}]
(assoc shape :x2 x :y2 y))
(defn- normalize-shape
"Normalize shape coordinates."
[shape]
@ -346,7 +334,6 @@
(case (:type shape)
:rect (setup-rect shape props)
:icon (setup-rect shape props)
:line (setup-rect shape props)
:text (setup-rect shape props)
:circle (setup-circle shape props)
:group (setup-group shape props)))
@ -389,7 +376,6 @@
:icon (generic-inner-rect state shape)
:rect (generic-inner-rect state shape)
:text (generic-inner-rect shape shape)
:line (generic-inner-rect state shape)
:path (path-inner-rect state shape)
:circle (circle-inner-rect state shape)
:group (group-inner-rect state shape))))
@ -455,7 +441,6 @@
:rect (generic-outer-rect state shape)
:text (generic-outer-rect state shape)
:icon (generic-outer-rect state shape)
:line (generic-outer-rect state shape)
;; :path (generic-outer-rect state shape)
:path (path-outer-rect state shape)
:circle (circle-outer-rect state shape)

View file

@ -16,7 +16,6 @@
[uxbox.main.ui.shapes.rect :as rect]
[uxbox.main.ui.shapes.circle :as circle]
[uxbox.main.ui.shapes.text :as text]
[uxbox.main.ui.shapes.line :as line]
[uxbox.main.ui.shapes.path :as path]
[uxbox.main.geom :as geom]))
@ -30,7 +29,6 @@
(case type
:group (group-component shape)
:text (text/text-component shape)
:line (line/line-component shape)
:icon (icon/icon-component shape)
:rect (rect/rect-component shape)
:path (path/path-component shape)

View file

@ -1,52 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.ui.shapes.line
(:require [sablono.core :refer-macros [html]]
[rum.core :as rum]
[uxbox.util.mixins :as mx]
[uxbox.main.ui.shapes.common :as common]
[uxbox.main.ui.shapes.attrs :as attrs]
[uxbox.main.geom :as geom]))
;; --- Line Component
(declare line-shape)
(defn- line-component-render
[own shape]
(let [{:keys [id x y width height group]} shape
selected (mx/react common/selected-ref)
selected? (contains? selected id)
on-mouse-down #(common/on-mouse-down % shape selected)]
(html
[:g.shape {:class (when selected? "selected")
:on-mouse-down on-mouse-down}
(line-shape shape identity)])))
(def line-component
(mx/component
{:render line-component-render
:name "line-component"
:mixins [mx/static mx/reactive]}))
;; --- Line Shape
(defn- line-shape-render
[own {:keys [id x1 y1 x2 y2] :as shape}]
(let [key (str "shape-" id)
props (select-keys shape [:x1 :x2 :y2 :y1])
attrs (-> (attrs/extract-style-attrs shape)
(merge {:id key :key key})
(merge props))]
(html
[:line attrs])))
(def line-shape
(mx/component
{:render line-shape-render
:name "line-shape"
:mixins [mx/static]}))

View file

@ -42,7 +42,6 @@
:ctrl+shift+z #(rs/emit! (udu/redo))
:ctrl+b #(rs/emit! (dw/select-for-drawing wsd/+draw-tool-rect+))
:ctrl+e #(rs/emit! (dw/select-for-drawing wsd/+draw-tool-circle+))
:ctrl+l #(rs/emit! (dw/select-for-drawing wsd/+draw-tool-line+))
:ctrl+t #(rs/emit! (dw/select-for-drawing wsd/+draw-tool-text+))
:esc #(rs/emit! (uds/deselect-all))
:backspace #(rs/emit! (uds/delete-selected))

View file

@ -41,12 +41,6 @@
{:type :circle
:name "Circle"})
(def +draw-tool-line+
{:type :line
:name "Line"
:stroke-type :solid
:stroke "#000000"})
(def +draw-tool-path+
{:type :path
:name "Path"
@ -72,10 +66,6 @@
:help (tr "ds.help.circle")
:shape +draw-tool-circle+
:priority 2}
{:icon i/line
:help (tr "ds.help.line")
:shape +draw-tool-line+
:priority 3}
{:icon i/text
:help (tr "ds.help.text")
:shape +draw-tool-text+

View file

@ -14,7 +14,6 @@
[uxbox.main.ui.shapes.icon :refer (icon-shape)]
[uxbox.main.ui.shapes.text :refer (text-shape)]
[uxbox.main.ui.shapes.group :refer (group-shape)]
[uxbox.main.ui.shapes.line :refer (line-shape)]
[uxbox.main.ui.shapes.path :refer (path-shape)]
[uxbox.main.ui.shapes.circle :refer (circle-shape)]
[uxbox.view.ui.viewer.interactions :as itx])
@ -65,7 +64,6 @@
(case type
:group (group-shape shape #(interactions-wrapper % shape*))
:text (text-shape shape)
:line (line-shape shape)
:icon (icon-shape shape)
:rect (rect-shape shape)
:path (path-shape shape)