mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-08 00:05:00 +00:00
fix division by zero in 'Repeat' node impl when count is exactly one
This commit is contained in:
parent
60d11c2abe
commit
5915b2de1f
1 changed files with 7 additions and 3 deletions
|
@ -229,9 +229,13 @@ async fn repeat<I: 'n + Send + Clone>(
|
||||||
let mut result_table = Instances::<I>::default();
|
let mut result_table = Instances::<I>::default();
|
||||||
|
|
||||||
for index in 0..count {
|
for index in 0..count {
|
||||||
let angle = index as f64 * angle / total;
|
let transform = if total == 0. {
|
||||||
let translation = index as f64 * direction / total;
|
DAffine2::IDENTITY
|
||||||
let transform = DAffine2::from_angle(angle) * DAffine2::from_translation(translation);
|
} else {
|
||||||
|
let angle = index as f64 * angle / total;
|
||||||
|
let translation = index as f64 * direction / total;
|
||||||
|
DAffine2::from_angle(angle) * DAffine2::from_translation(translation)
|
||||||
|
};
|
||||||
|
|
||||||
for instance in instance.instance_ref_iter() {
|
for instance in instance.instance_ref_iter() {
|
||||||
let mut instance = instance.to_instance_cloned();
|
let mut instance = instance.to_instance_cloned();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue