Skip to content

Commit 8aafcb6

Browse files
Ripper53Keavon
authored andcommitted
Fix spacing modes.
1 parent 394d575 commit 8aafcb6

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

editor/src/messages/portfolio/document/node_graph/node_properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use graphene_std::vector::VectorDataTable;
2828
use graphene_std::vector::misc::ArcType;
2929
use graphene_std::vector::misc::{BooleanOperation, GridType};
3030
use graphene_std::vector::style::{CircularSpacing, Fill, FillChoice, FillType, GradientStops, Spacing};
31-
use graphene_std::{GraphicGroupTable, NodeInputDecleration, RasterFrame};
31+
use graphene_std::{GraphicGroupTable, NodeInputDecleration};
3232

3333
pub(crate) fn string_properties(text: &str) -> Vec<LayoutGroup> {
3434
let widget = TextLabel::new(text).widget_holder();

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)