Skip to content

Commit a969f79

Browse files
committed
Fix spacing modes.
1 parent 5fe4e00 commit a969f79

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

node-graph/gcore/src/vector/vector_nodes.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ async fn repeat<I: 'n + Send + Clone>(
210210
#[default(100., 100.)]
211211
// TODO: When using a custom Properties panel layout in document_node_definitions.rs and this default is set, the widget weirdly doesn't show up in the Properties panel. Investigation is needed.
212212
direction: PixelSize,
213-
angle: Angle,
213+
#[unit("°")] angle: f64,
214214
#[default(4)] instances: IntegerCount,
215215
spacing: Spacing,
216216
) -> Instances<I>
@@ -231,12 +231,11 @@ where
231231
for index in 0..count {
232232
let angle = index as f64 * angle / total;
233233
let mut translation = index as f64 * direction / total;
234-
let mut size = index as f64 * exact_size / total;
235234

236-
// let transform = DAffine2::from_angle(angle) * DAffine2::from_translation(translation);
237235
let transform = match spacing {
238-
Spacing::Span => DAffine2::from_translation(translation) * DAffine2::from_angle(angle),
236+
Spacing::Span => DAffine2::from_angle(angle) * DAffine2::from_translation(translation),
239237
Spacing::Envelope => {
238+
let mut size = index as f64 * exact_size / total;
240239
if direction.x < -exact_size.x {
241240
size.x -= size.x * 2.;
242241
} else if direction.x <= exact_size.x {
@@ -252,11 +251,11 @@ where
252251
if size == DVec2::ZERO {
253252
DAffine2::from_angle(angle)
254253
} else {
255-
DAffine2::from_translation(size).inverse() * DAffine2::from_translation(translation) * DAffine2::from_angle(angle)
254+
DAffine2::from_angle(angle) * DAffine2::from_translation(size).inverse() * DAffine2::from_translation(translation)
256255
}
257256
}
258-
Spacing::Pitch => DAffine2::from_translation(index as f64 * direction) * DAffine2::from_angle(angle),
259-
Spacing::Gap => DAffine2::from_translation(index as f64 * exact_size) * DAffine2::from_translation(index as f64 * direction) * DAffine2::from_angle(angle),
257+
Spacing::Pitch => DAffine2::from_angle(angle) * DAffine2::from_translation(index as f64 * direction),
258+
Spacing::Gap => DAffine2::from_angle(angle) * DAffine2::from_translation(index as f64 * exact_size) * DAffine2::from_translation(index as f64 * direction),
260259
};
261260

262261
for instance in instance.instance_ref_iter() {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy