diff --git a/frontend/src/app/main/data/workspace/modifiers.cljs b/frontend/src/app/main/data/workspace/modifiers.cljs index 23b751c72e..fd0dbb2ce4 100644 --- a/frontend/src/app/main/data/workspace/modifiers.cljs +++ b/frontend/src/app/main/data/workspace/modifiers.cljs @@ -633,7 +633,7 @@ [modif-tree & {:keys [ignore-constraints ignore-snap-pixel snap-ignore-axis undo-group] :or {ignore-constraints false ignore-snap-pixel false snap-ignore-axis nil undo-group nil} :as params}] - (ptk/reify ::apply-wasm-modifiesr + (ptk/reify ::apply-wasm-modifiers ptk/WatchEvent (watch [_ state _] (let [objects (dsh/lookup-page-objects state) diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 9a1bcaa319..e170566e06 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -146,12 +146,19 @@ (defn start-resize "Enter mouse resize mode, until mouse button is released." [handler ids shape] - (letfn [(resize [shape initial layout [point lock? center? point-snap]] + (letfn [(resize [shape initial layout [point lock? center? ignore-constraints? point-snap]] (let [selrect (dm/get-prop shape :selrect) width (dm/get-prop selrect :width) height (dm/get-prop selrect :height) rotation (dm/get-prop shape :rotation) + shape-type (:type shape) + is-frame? (= :frame shape-type) + ignore-constraints? (and ^boolean ignore-constraints? + ^boolean is-frame?) + + _ (prn "ignore-constraints?" ignore-constraints?) + shape-center (gsh/shape->center shape) shape-transform (:transform shape) shape-transform-inverse (:transform-inverse shape) @@ -259,12 +266,13 @@ ;; Unifies the instantaneous proportion lock modifier ;; activated by Shift key and the shapes own proportion ;; lock flag that can be activated on element options. - (normalize-proportion-lock [[point shift? alt?]] + (normalize-proportion-lock [[point shift? alt? mod?]] (let [proportion-lock? (:proportion-lock shape)] [point (or ^boolean proportion-lock? ^boolean shift?) - alt?]))] + alt? + mod?]))] (reify ptk/UpdateEvent (update [_ state] @@ -286,7 +294,7 @@ resize-events-stream (->> ms/mouse-position (rx/filter some?) - (rx/with-latest-from ms/mouse-position-shift ms/mouse-position-alt) + (rx/with-latest-from ms/mouse-position-shift ms/mouse-position-alt ms/mouse-position-mod) (rx/map normalize-proportion-lock) (rx/switch-map (fn [[point _ _ :as current]] @@ -316,7 +324,8 @@ (rx/map #(dwm/apply-wasm-modifiers (dwm/create-modif-tree ids %) - :ignore-constraints (contains? layout :scale-text))))) + :ignore-constraints (or (contains? layout :scale-text) + false))))) (->> resize-events-stream (rx/mapcat @@ -1055,11 +1064,11 @@ (if (features/active-feature? state "render-wasm/v1") (rx/of (dwm/apply-wasm-modifiers modif-tree - {:ignore-constraints false + {:ignore-constraints true :ignore-snap-pixel true})) (rx/of (dwm/apply-modifiers {:modifiers modif-tree - :ignore-constraints false + :ignore-constraints true :ignore-snap-pixel true}))))))) (defn- cleanup-invalid-moving-shapes [ids objects frame-id] diff --git a/frontend/src/app/main/ui/workspace/viewport/selection.cljs b/frontend/src/app/main/ui/workspace/viewport/selection.cljs index 8b304eb2b7..4d3ab2521d 100644 --- a/frontend/src/app/main/ui/workspace/viewport/selection.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/selection.cljs @@ -508,7 +508,9 @@ (dom/stop-propagation event) (let [target (dom/get-current-target event) position (-> (dom/get-data target "position") - (keyword))] + (keyword)) + ignore-constraints? (.-ctrlKey event)] + (prn "single-handlers* ignore-constraints?" ignore-constraints? "shape-type" shape-type) (cond ;; If text and in auto-width and the resize is horizontal, switch to auto-height and mark direction (and (= shape-type :text)