moving more of the logic to slide_model
With more of the logic coming to the rust models, I can start to make compile time guarantees.
This commit is contained in:
parent
8c7f2d794f
commit
8463af6ad9
3 changed files with 21 additions and 34 deletions
|
|
@ -1122,9 +1122,26 @@ impl slide_model::SlideModel {
|
|||
pub fn next(mut self: Pin<&mut Self>) -> bool {
|
||||
if let Some(object) = unsafe { self.slide_object.as_mut() } {
|
||||
let object = unsafe { Pin::new_unchecked(object) };
|
||||
if let Some(slide) = self.rust().slides.get(self.id as usize + 1) {
|
||||
let id = self.as_ref().id + 1;
|
||||
if let Some(slide) = self.rust().slides.get(id as usize) {
|
||||
object.set_slide(slide);
|
||||
self.as_mut().activate(id);
|
||||
self.as_mut().rust_mut().id = id;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prev(mut self: Pin<&mut Self>) -> bool {
|
||||
if let Some(object) = unsafe { self.slide_object.as_mut() } {
|
||||
let object = unsafe { Pin::new_unchecked(object) };
|
||||
let id = self.as_ref().id - 1;
|
||||
if let Some(slide) = self.rust().slides.get(id as usize) {
|
||||
object.set_slide(slide);
|
||||
let id = self.as_ref().id + 1;
|
||||
self.as_mut().activate(id);
|
||||
self.as_mut().rust_mut().id = id;
|
||||
true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue