File tree Expand file tree Collapse file tree 4 files changed +9
-18
lines changed
.clj-kondo/metosin/malli-types-cljs Expand file tree Collapse file tree 4 files changed +9
-18
lines changed Original file line number Diff line number Diff line change 6549
6549
:pen-mode :boolean}}
6550
6550
:any],
6551
6551
:ret :vector}}},
6552
- duplicate {:arities {2 {:args [{:op :keys,
6552
+ duplicate {:arities {1 {:args [{:op :keys,
6553
6553
:opt {:explanation :string,
6554
6554
:system-fonts :vector,
6555
6555
:copied-bounds :seqable,
6622
6622
:panels :map,
6623
6623
:worker {:op :keys,
6624
6624
:req {:tasks :map}},
6625
- :pen-mode :boolean}}
6626
- :seqable],
6625
+ :pen-mode :boolean}}],
6627
6626
:ret {:op :keys,
6628
6627
:opt {:explanation :string,
6629
6628
:system-fonts :vector,
Original file line number Diff line number Diff line change 206
206
[(finalize " Scale selection" )]
207
207
(fn [db [_ ratio]]
208
208
(let [pivot-point (-> db h/bounds bounds/center)]
209
- (h/scale db ratio pivot-point {} ))))
209
+ (h/scale db ratio pivot-point false ))))
210
210
211
211
(rf/reg-event-db
212
212
::move-up
Original file line number Diff line number Diff line change 19
19
[renderer.utils.extra :refer [partial-right]]
20
20
[renderer.utils.hiccup :as hiccup]
21
21
[renderer.utils.map :as map]
22
- [renderer.utils.math :refer [Vec2D]]
23
22
[renderer.utils.path :as path]
24
23
[renderer.utils.vec :as vec]))
25
24
534
533
(update-el db id hierarchy/place pos)))
535
534
536
535
(defn scale
537
- [db ratio pivot-point { :keys [in-place recursive]} ]
536
+ [db ratio pivot-point recursive]
538
537
(let [ids-to-scale (cond-> (selected-ids db) recursive (set/union (descendant-ids db)))]
539
538
(reduce
540
539
(fn [db id]
541
- (let [pivot-point (->> (entity db id) :bounds (take 2 ) (mat/sub pivot-point))
542
- db (update-el db id hierarchy/scale ratio pivot-point)]
543
- (if in-place
544
- ; ; FIXME: Handle locked ratio.
545
- (let [pointer-delta (mat/sub (:adjusted-pointer-pos db) (:adjusted-pointer-offset db))
546
- child-ids (set (children-ids db id))
547
- child-ids (set/intersection child-ids ids-to-scale)]
548
- (reduce (partial-right translate pointer-delta) db child-ids))
549
- db)))
540
+ (let [pivot-point (->> (entity db id) :bounds (take 2 ) (mat/sub pivot-point))]
541
+ (update-el db id hierarchy/scale ratio pivot-point)))
550
542
db
551
543
ids-to-scale)))
552
544
Original file line number Diff line number Diff line change 202
202
203
203
(m/=> scale [:-> App Vec2D map? App])
204
204
(defn scale
205
- [db offset {:keys [ratio-locked in-place] :as options }]
205
+ [db offset {:keys [ratio-locked in-place recursive] }]
206
206
(let [handle (-> db :clicked-element :id )
207
207
bounds (element.h/bounds db)
208
208
[offset pivot-point] (delta->scale-with-pivot-point handle offset bounds)
211
211
dimensions (bounds/->dimensions bounds)
212
212
ratio (mat/div (mat/add dimensions offset) dimensions)
213
213
ratio (cond-> ratio ratio-locked (lock-ratio handle))
214
- ; ; TODO: Handle negative ratio.
214
+ ; ; TODO: Handle negative ratio, and position on recursive scale .
215
215
ratio (mapv #(max % 0.01 ) ratio)]
216
216
(-> db
217
217
(assoc :pivot-point pivot-point)
218
- (element.h/scale ratio pivot-point options ))))
218
+ (element.h/scale ratio pivot-point recursive ))))
219
219
220
220
(m/=> select-element [:-> App boolean? App])
221
221
(defn select-element
You can’t perform that action at this time.
0 commit comments