View / add a resolveConstraints method to end interactions
This will help making sure that the view will come back to a "rested" state once the interactions are over. Interactions no longer need to handle the animation back to a rested state, they simply call `endInteraction` with the desired duration and direction.
This commit is contained in:
@@ -8,27 +8,15 @@ describe('ol.rotationconstraint', function() {
|
||||
it('returns expected rotation value', function() {
|
||||
const rotationConstraint = createSnapToZero(0.3);
|
||||
|
||||
expect(rotationConstraint(0.1, 0)).to.eql(0);
|
||||
expect(rotationConstraint(0.2, 0)).to.eql(0);
|
||||
expect(rotationConstraint(0.3, 0)).to.eql(0);
|
||||
expect(rotationConstraint(0.4, 0)).to.eql(0.4);
|
||||
expect(rotationConstraint(0.1)).to.eql(0);
|
||||
expect(rotationConstraint(0.2)).to.eql(0);
|
||||
expect(rotationConstraint(0.3)).to.eql(0);
|
||||
expect(rotationConstraint(0.4)).to.eql(0.4);
|
||||
|
||||
expect(rotationConstraint(-0.1, 0)).to.eql(0);
|
||||
expect(rotationConstraint(-0.2, 0)).to.eql(0);
|
||||
expect(rotationConstraint(-0.3, 0)).to.eql(0);
|
||||
expect(rotationConstraint(-0.4, 0)).to.eql(-0.4);
|
||||
|
||||
expect(rotationConstraint(1, -0.9)).to.eql(0);
|
||||
expect(rotationConstraint(1, -0.8)).to.eql(0);
|
||||
// floating-point arithmetic
|
||||
expect(rotationConstraint(1, -0.7)).not.to.eql(0);
|
||||
expect(rotationConstraint(1, -0.6)).to.eql(0.4);
|
||||
|
||||
expect(rotationConstraint(-1, 0.9)).to.eql(0);
|
||||
expect(rotationConstraint(-1, 0.8)).to.eql(0);
|
||||
// floating-point arithmetic
|
||||
expect(rotationConstraint(-1, 0.7)).not.to.eql(0);
|
||||
expect(rotationConstraint(-1, 0.6)).to.eql(-0.4);
|
||||
expect(rotationConstraint(-0.1)).to.eql(0);
|
||||
expect(rotationConstraint(-0.2)).to.eql(0);
|
||||
expect(rotationConstraint(-0.3)).to.eql(0);
|
||||
expect(rotationConstraint(-0.4)).to.eql(-0.4);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user