diff --git a/resources/styles/partials/workspace-canvas.scss b/resources/styles/partials/workspace-canvas.scss index 7d8712258..1ca94c885 100644 --- a/resources/styles/partials/workspace-canvas.scss +++ b/resources/styles/partials/workspace-canvas.scss @@ -50,6 +50,10 @@ circle.bottom-right { cursor: nwse-resize; } circle.top-right { cursor: nesw-resize; } circle.bottom-left { cursor: nesw-resize; } + rect.top { cursor: ns-resize; } + rect.bottom { cursor: ns-resize; } + rect.left { cursor: ew-resize; } + rect.right { cursor: ew-resize; } } } diff --git a/src/uxbox/ui/shapes/icon.cljs b/src/uxbox/ui/shapes/icon.cljs index 6b46882a8..2dad15ee7 100644 --- a/src/uxbox/ui/shapes/icon.cljs +++ b/src/uxbox/ui/shapes/icon.cljs @@ -93,6 +93,38 @@ [:rect {:x x :y y :width width :height height :stroke-dasharray "5,5" :style {:stroke "#333" :fill "transparent" :stroke-opacity "1"}}] + [:rect.top + {:fill "#333" + :on-mouse-up #(on-mouse-up 5 %) + :on-mouse-down #(on-mouse-down 5 %) + :x (- (+ x (/ width 2)) 7) + :width 14 + :height 3 + :y (- y 5)}] + [:rect.right + {:fill "#333" + :on-mouse-up #(on-mouse-up 6 %) + :on-mouse-down #(on-mouse-down 6 %) + :y (- (+ y (/ height 2)) 7) + :width 3 + :height 14 + :x (+ x width 2)}] + [:rect.bottom + {:fill "#333" + :on-mouse-up #(on-mouse-up 7 %) + :on-mouse-down #(on-mouse-down 7 %) + :x (- (+ x (/ width 2)) 7) + :width 14 + :height 3 + :y (+ y height 2)}] + [:rect.left + {:fill "#333" + :on-mouse-up #(on-mouse-up 8 %) + :on-mouse-down #(on-mouse-down 8 %) + :y (- (+ y (/ height 2)) 7) + :width 3 + :height 14 + :x (- x 5)}] [:circle.top-left (merge uusc/+circle-props+ {:on-mouse-up #(on-mouse-up 1 %) diff --git a/src/uxbox/util/geom.cljs b/src/uxbox/util/geom.cljs index 42ec854d8..22d6b9d8c 100644 --- a/src/uxbox/util/geom.cljs +++ b/src/uxbox/util/geom.cljs @@ -195,7 +195,15 @@ :y2 (max y1 (+ y2 dy))) 4 (assoc shape :x2 (max x1 (+ x2 dx)) - :y2 (max y1 (+ y2 dy)))))) + :y2 (max y1 (+ y2 dy))) + 5 (assoc shape + :y1 (min y2 (+ y1 dy))) + 6 (assoc shape + :x2 (max x1 (+ x2 dx))) + 7 (assoc shape + :y2 (max y1 (+ y2 dy))) + 8 (assoc shape + :x1 (min x2 (+ x1 dx)))))) (defn- move-circle-vertex "A specialized function for vertex movement @@ -204,17 +212,21 @@ (let [[dx dy] (if lock [dx dx] [dx dy])] (case vid 1 (assoc shape - :rx (- (:rx shape) dx) - :ry (- (:ry shape) dy)) + :rx (max 0 (- (:rx shape) dx)) + :ry (max 0 (- (:ry shape) dy))) 2 (assoc shape - :rx (+ (:rx shape) dx) - :ry (- (:ry shape) dy)) + :rx (max 0 (+ (:rx shape) dx)) + :ry (max 0 (- (:ry shape) dy))) 3 (assoc shape - :rx (- (:rx shape) dx) - :ry (+ (:ry shape) dy)) + :rx (max 0 (- (:rx shape) dx)) + :ry (max 0 (+ (:ry shape) dy))) 4 (assoc shape - :rx (+ (:rx shape) dx) - :ry (+ (:ry shape) dy))))) + :rx (max 0 (+ (:rx shape) dx)) + :ry (max 0 (+ (:ry shape) dy))) + 5 (assoc shape :ry (max 0 (- (:ry shape) dy))) + 6 (assoc shape :rx (max 0 (+ (:rx shape) dx))) + 7 (assoc shape :ry (max 0 (+ (:ry shape) dy))) + 8 (assoc shape :rx (max 0 (+ (:rx shape) dx)))))) ;; --- Resize (Absolute)