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.
24 lines
694 B
JavaScript
24 lines
694 B
JavaScript
import {createSnapToZero} from '../../../src/ol/rotationconstraint.js';
|
|
|
|
|
|
describe('ol.rotationconstraint', function() {
|
|
|
|
describe('SnapToZero', function() {
|
|
|
|
it('returns expected rotation value', function() {
|
|
const rotationConstraint = createSnapToZero(0.3);
|
|
|
|
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)).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);
|
|
});
|
|
|
|
});
|
|
});
|