more
This commit is contained in:
parent
0b8a433640
commit
7f68fd9b21
@ -37,12 +37,16 @@ impl MouseInterpolator{
|
||||
//The first element is guaranteed to exist.
|
||||
let mut iter=self.queue.iter();
|
||||
//find a mouse input
|
||||
'outer: loop{
|
||||
'outer:loop{
|
||||
match iter.next(){
|
||||
Some(ins0)=>{
|
||||
let physics_input=match &ins0.instruction{
|
||||
InputInstruction::MoveMouse(mouse0)=>{
|
||||
loop{
|
||||
//mouse instruction found.
|
||||
//enter a new loop with different behaviour
|
||||
//we have to wait for the next mouse event
|
||||
//so there is a before and after interpolation target
|
||||
'inner:loop{
|
||||
match iter.next(){
|
||||
Some(ins1)=>match ins1.instruction{
|
||||
InputInstruction::MoveMouse(mouse1)=>{
|
||||
@ -52,8 +56,13 @@ impl MouseInterpolator{
|
||||
//drain and handle the elements from the front
|
||||
break 'outer;
|
||||
},
|
||||
_=>{
|
||||
//TODO: 10ms<ins.time-time break and do something else
|
||||
_=>if Time::from_millis(10)<ins1.time-ins0.time{
|
||||
//we have passed more than 10ms of instructions and have not seen a mouse event.
|
||||
//drop the iterator so we can consume the queue up to this point
|
||||
std::mem::drop(iter);
|
||||
//make a new iterator starting from the new beginning and loop like nothing happened
|
||||
iter=self.queue.iter();
|
||||
continue 'outer;
|
||||
},
|
||||
},
|
||||
None=>{
|
||||
|
Loading…
Reference in New Issue
Block a user