Skip to content

Commit f471ff8

Browse files
committed
remove chain_index requirement for frame
Was left over from a previous API.
1 parent b966371 commit f471ff8

File tree

7 files changed

+51
-80
lines changed

7 files changed

+51
-80
lines changed

src/keyframes/button.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ impl Chain {
4444
}
4545
}
4646

47-
pub fn link(mut self, mut button: Button) -> Self {
48-
button.chain_index = self.links.len();
47+
pub fn link(mut self, button: Button) -> Self {
4948
self.links.push(button);
5049
self
5150
}
@@ -75,7 +74,6 @@ where
7574
#[derive(Debug, Clone, Copy)]
7675
pub struct Button {
7776
index: usize,
78-
chain_index: usize,
7977
at: MovementType,
8078
ease: Ease,
8179
width: Option<Length>,
@@ -88,7 +86,6 @@ impl Button {
8886
let at = at.into();
8987
Button {
9088
index: 0,
91-
chain_index: 0,
9289
at,
9390
ease: Linear::InOut.into(),
9491
width: None,
@@ -153,26 +150,26 @@ impl Iterator for Button {
153150
self.index += 1;
154151
match self.index - 1 {
155152
0 => Some(
156-
as_f32(self.width).map(|w| Frame::eager(self.chain_index, self.at, w, self.ease)),
153+
as_f32(self.width).map(|w| Frame::eager(self.at, w, self.ease)),
157154
),
158155
1 => Some(
159-
as_f32(self.height).map(|h| Frame::eager(self.chain_index, self.at, h, self.ease)),
156+
as_f32(self.height).map(|h| Frame::eager(self.at, h, self.ease)),
160157
),
161158
2 => Some(
162159
self.padding
163-
.map(|p| Frame::eager(self.chain_index, self.at, p.top, self.ease)),
160+
.map(|p| Frame::eager(self.at, p.top, self.ease)),
164161
),
165162
3 => Some(
166163
self.padding
167-
.map(|p| Frame::eager(self.chain_index, self.at, p.right, self.ease)),
164+
.map(|p| Frame::eager(self.at, p.right, self.ease)),
168165
),
169166
4 => Some(
170167
self.padding
171-
.map(|p| Frame::eager(self.chain_index, self.at, p.bottom, self.ease)),
168+
.map(|p| Frame::eager(self.at, p.bottom, self.ease)),
172169
),
173170
5 => Some(
174171
self.padding
175-
.map(|p| Frame::eager(self.chain_index, self.at, p.left, self.ease)),
172+
.map(|p| Frame::eager(self.at, p.left, self.ease)),
176173
),
177174
_ => None,
178175
}

src/keyframes/container.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ impl Chain {
4444
}
4545
}
4646

47-
pub fn link(mut self, mut container: Container) -> Self {
48-
container.chain_index = self.links.len();
47+
pub fn link(mut self, container: Container) -> Self {
4948
self.links.push(container);
5049
self
5150
}
@@ -75,7 +74,6 @@ where
7574
#[derive(Debug, Clone, Copy)]
7675
pub struct Container {
7776
index: usize,
78-
chain_index: usize,
7977
at: MovementType,
8078
ease: Ease,
8179
width: Option<Length>,
@@ -90,7 +88,6 @@ impl Container {
9088
let at = at.into();
9189
Container {
9290
index: 0,
93-
chain_index: 0,
9491
at,
9592
ease: Linear::InOut.into(),
9693
width: None,
@@ -181,34 +178,34 @@ impl Iterator for Container {
181178
self.index += 1;
182179
match self.index - 1 {
183180
0 => Some(
184-
as_f32(self.width).map(|w| Frame::eager(self.chain_index, self.at, w, self.ease)),
181+
as_f32(self.width).map(|w| Frame::eager(self.at, w, self.ease)),
185182
),
186183
1 => Some(
187-
as_f32(self.height).map(|h| Frame::eager(self.chain_index, self.at, h, self.ease)),
184+
as_f32(self.height).map(|h| Frame::eager(self.at, h, self.ease)),
188185
),
189186
2 => Some(
190187
self.padding
191-
.map(|p| Frame::eager(self.chain_index, self.at, p.top, self.ease)),
188+
.map(|p| Frame::eager(self.at, p.top, self.ease)),
192189
),
193190
3 => Some(
194191
self.padding
195-
.map(|p| Frame::eager(self.chain_index, self.at, p.right, self.ease)),
192+
.map(|p| Frame::eager(self.at, p.right, self.ease)),
196193
),
197194
4 => Some(
198195
self.padding
199-
.map(|p| Frame::eager(self.chain_index, self.at, p.bottom, self.ease)),
196+
.map(|p| Frame::eager(self.at, p.bottom, self.ease)),
200197
),
201198
5 => Some(
202199
self.padding
203-
.map(|p| Frame::eager(self.chain_index, self.at, p.left, self.ease)),
200+
.map(|p| Frame::eager(self.at, p.left, self.ease)),
204201
),
205202
6 => Some(
206203
self.max_width
207-
.map(|w| Frame::eager(self.chain_index, self.at, w, self.ease)),
204+
.map(|w| Frame::eager(self.at, w, self.ease)),
208205
),
209206
7 => Some(
210207
self.max_height
211-
.map(|h| Frame::eager(self.chain_index, self.at, h, self.ease)),
208+
.map(|h| Frame::eager(self.at, h, self.ease)),
212209
),
213210
_ => None,
214211
}

src/keyframes/space.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ impl Chain {
4444
}
4545
}
4646

47-
pub fn link(mut self, mut space: Space) -> Self {
48-
space.chain_index = self.links.len();
47+
pub fn link(mut self, space: Space) -> Self {
4948
self.links.push(space);
5049
self
5150
}
@@ -75,7 +74,6 @@ where
7574
#[derive(Debug, Clone, Copy)]
7675
pub struct Space {
7776
index: usize,
78-
chain_index: usize,
7977
at: MovementType,
8078
ease: Ease,
8179
width: Option<Length>,
@@ -88,7 +86,6 @@ impl Space {
8886
let at = at.into();
8987
Space {
9088
index: 0,
91-
chain_index: 0,
9289
at,
9390
ease: Linear::InOut.into(),
9491
width: None,
@@ -101,7 +98,6 @@ impl Space {
10198
let at = at.into();
10299
Space {
103100
index: 0,
104-
chain_index: 0,
105101
at,
106102
ease: Linear::InOut.into(),
107103
width: None,
@@ -148,18 +144,18 @@ impl Iterator for Space {
148144
0 => {
149145
let frame = if self.is_eager {
150146
as_f32(self.width)
151-
.map(|w| Frame::eager(self.chain_index, self.at, w, self.ease))
147+
.map(|w| Frame::eager(self.at, w, self.ease))
152148
} else {
153-
Some(Frame::lazy(self.chain_index, self.at, 0.0, self.ease))
149+
Some(Frame::lazy(self.at, 0.0, self.ease))
154150
};
155151
Some(frame)
156152
}
157153
1 => {
158154
let frame = if self.is_eager {
159155
as_f32(self.height)
160-
.map(|h| Frame::eager(self.chain_index, self.at, h, self.ease))
156+
.map(|h| Frame::eager(self.at, h, self.ease))
161157
} else {
162-
Some(Frame::lazy(self.chain_index, self.at, 0.0, self.ease))
158+
Some(Frame::lazy(self.at, 0.0, self.ease))
163159
};
164160
Some(frame)
165161
}

src/keyframes/style_button.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ impl Chain {
4545
}
4646
}
4747

48-
pub fn link(mut self, mut button: StyleButton) -> Self {
49-
button.chain_index = self.links.len();
48+
pub fn link(mut self, button: StyleButton) -> Self {
5049
self.links.push(button);
5150
self
5251
}
@@ -76,7 +75,6 @@ where
7675
#[derive(Debug, Clone, Copy)]
7776
pub struct StyleButton {
7877
index: usize,
79-
chain_index: usize,
8078
at: MovementType,
8179
ease: Ease,
8280
width: Option<Length>,
@@ -90,7 +88,6 @@ impl StyleButton {
9088
let at = at.into();
9189
StyleButton {
9290
index: 0,
93-
chain_index: 0,
9491
at,
9592
ease: Linear::InOut.into(),
9693
width: None,
@@ -178,30 +175,30 @@ impl Iterator for StyleButton {
178175
self.index += 1;
179176
match self.index - 1 {
180177
0 => Some(
181-
as_f32(self.width).map(|w| Frame::eager(self.chain_index, self.at, w, self.ease)),
178+
as_f32(self.width).map(|w| Frame::eager(self.at, w, self.ease)),
182179
),
183180
1 => Some(
184-
as_f32(self.height).map(|h| Frame::eager(self.chain_index, self.at, h, self.ease)),
181+
as_f32(self.height).map(|h| Frame::eager(self.at, h, self.ease)),
185182
),
186183
2 => Some(
187184
self.padding
188-
.map(|p| Frame::eager(self.chain_index, self.at, p.top, self.ease)),
185+
.map(|p| Frame::eager(self.at, p.top, self.ease)),
189186
),
190187
3 => Some(
191188
self.padding
192-
.map(|p| Frame::eager(self.chain_index, self.at, p.right, self.ease)),
189+
.map(|p| Frame::eager(self.at, p.right, self.ease)),
193190
),
194191
4 => Some(
195192
self.padding
196-
.map(|p| Frame::eager(self.chain_index, self.at, p.bottom, self.ease)),
193+
.map(|p| Frame::eager(self.at, p.bottom, self.ease)),
197194
),
198195
5 => Some(
199196
self.padding
200-
.map(|p| Frame::eager(self.chain_index, self.at, p.left, self.ease)),
197+
.map(|p| Frame::eager(self.at, p.left, self.ease)),
201198
),
202199
6 => Some(
203200
self.style
204-
.map(|s| Frame::eager(self.chain_index, self.at, s as f32, self.ease)),
201+
.map(|s| Frame::eager(self.at, s as f32, self.ease)),
205202
),
206203
_ => None,
207204
}

src/keyframes/style_container.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ impl Chain {
4545
}
4646
}
4747

48-
pub fn link(mut self, mut container: StyleContainer) -> Self {
49-
container.chain_index = self.links.len();
48+
pub fn link(mut self, container: StyleContainer) -> Self {
5049
self.links.push(container);
5150
self
5251
}
@@ -76,7 +75,6 @@ where
7675
#[derive(Debug, Clone, Copy)]
7776
pub struct StyleContainer {
7877
index: usize,
79-
chain_index: usize,
8078
at: MovementType,
8179
ease: Ease,
8280
width: Option<Length>,
@@ -92,7 +90,6 @@ impl StyleContainer {
9290
let at = at.into();
9391
StyleContainer {
9492
index: 0,
95-
chain_index: 0,
9693
at,
9794
ease: Linear::InOut.into(),
9895
width: None,
@@ -206,38 +203,38 @@ impl Iterator for StyleContainer {
206203
self.index += 1;
207204
match self.index - 1 {
208205
0 => Some(
209-
as_f32(self.width).map(|w| Frame::eager(self.chain_index, self.at, w, self.ease)),
206+
as_f32(self.width).map(|w| Frame::eager(self.at, w, self.ease)),
210207
),
211208
1 => Some(
212-
as_f32(self.height).map(|h| Frame::eager(self.chain_index, self.at, h, self.ease)),
209+
as_f32(self.height).map(|h| Frame::eager(self.at, h, self.ease)),
213210
),
214211
2 => Some(
215212
self.padding
216-
.map(|p| Frame::eager(self.chain_index, self.at, p.top, self.ease)),
213+
.map(|p| Frame::eager(self.at, p.top, self.ease)),
217214
),
218215
3 => Some(
219216
self.padding
220-
.map(|p| Frame::eager(self.chain_index, self.at, p.right, self.ease)),
217+
.map(|p| Frame::eager(self.at, p.right, self.ease)),
221218
),
222219
4 => Some(
223220
self.padding
224-
.map(|p| Frame::eager(self.chain_index, self.at, p.bottom, self.ease)),
221+
.map(|p| Frame::eager(self.at, p.bottom, self.ease)),
225222
),
226223
5 => Some(
227224
self.padding
228-
.map(|p| Frame::eager(self.chain_index, self.at, p.left, self.ease)),
225+
.map(|p| Frame::eager(self.at, p.left, self.ease)),
229226
),
230227
6 => Some(
231228
self.max_width
232-
.map(|w| Frame::eager(self.chain_index, self.at, w, self.ease)),
229+
.map(|w| Frame::eager(self.at, w, self.ease)),
233230
),
234231
7 => Some(
235232
self.max_height
236-
.map(|h| Frame::eager(self.chain_index, self.at, h, self.ease)),
233+
.map(|h| Frame::eager(self.at, h, self.ease)),
237234
),
238235
8 => Some(
239236
self.style
240-
.map(|s| Frame::eager(self.chain_index, self.at, s as f32, self.ease)),
237+
.map(|s| Frame::eager(self.at, s as f32, self.ease)),
241238
),
242239
_ => None,
243240
}

src/keyframes/toggler.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ impl Chain {
4444
}
4545
}
4646

47-
pub fn link(mut self, mut toggler: Toggler) -> Self {
48-
toggler.chain_index = self.links.len();
47+
pub fn link(mut self, toggler: Toggler) -> Self {
4948
self.links.push(toggler);
5049
self
5150
}
@@ -75,7 +74,6 @@ where
7574
#[derive(Debug, Clone, Copy)]
7675
pub struct Toggler {
7776
index: usize,
78-
chain_index: usize,
7977
at: MovementType,
8078
ease: Ease,
8179
percent: f32,
@@ -86,7 +84,6 @@ impl Toggler {
8684
let at = at.into();
8785
Toggler {
8886
index: 0,
89-
chain_index: 0,
9087
at,
9188
ease: Linear::InOut.into(),
9289
percent: 1.0,
@@ -132,7 +129,6 @@ impl Iterator for Toggler {
132129
self.index += 1;
133130
match self.index - 1 {
134131
0 => Some(Some(Frame::eager(
135-
self.chain_index,
136132
self.at,
137133
self.percent,
138134
self.ease,

0 commit comments

Comments
 (0)