Skip to content

Commit

Permalink
skip: review apply
Browse files Browse the repository at this point in the history
  • Loading branch information
Jongmoon Yoon committed Oct 30, 2017
1 parent 6b475c6 commit 60de744
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion declaration/AnimationManager.d.ts
Expand Up @@ -45,6 +45,6 @@ export declare class AnimationManager {
animateTo(destPos: Axis, duration: number, option?: ChangeEventOption): void;
private frame(param);
easing(p: any): number;
setTo(pos: Axis, duration?: number, useCircular?: boolean): this;
setTo(pos: Axis, duration?: number): this;
setBy(pos: Axis, duration?: number): this;
}
7 changes: 3 additions & 4 deletions src/AnimationManager.ts
Expand Up @@ -209,7 +209,7 @@ export class AnimationManager {
return p > 1 ? 1 : this.options.easing(p);
}

setTo(pos: Axis, duration: number = 0, useCircular: boolean = false) {
setTo(pos: Axis, duration: number = 0) {
const axes: string[] = Object.keys(pos);
this.grab(axes);
const orgPos: Axis = this.axm.get(axes);
Expand All @@ -224,7 +224,7 @@ export class AnimationManager {
}

movedPos = this.axm.map(movedPos, (v, k, opt) => {
if (useCircular && opt.circular && (opt.circular[0] || opt.circular[1])) {
if (opt.circular && (opt.circular[0] || opt.circular[1])) {
return duration > 0 ? v : Coordinate.getCirculatedPos(v, opt.range, opt.circular as boolean[]);
} else {
return Coordinate.getInsidePosition(v, opt.range, opt.circular as boolean[]);
Expand All @@ -248,8 +248,7 @@ export class AnimationManager {
setBy(pos: Axis, duration = 0) {
return this.setTo(
this.axm.map(this.axm.get(Object.keys(pos)), (v, k) => v + pos[k]),
duration,
true
duration
);
}
};
10 changes: 5 additions & 5 deletions test/unit/AnimationManager.spec.js
Expand Up @@ -171,7 +171,7 @@ describe("AnimationManager", function () {
expect(endHandler.called).to.be.false;
expect(changeHandler.called).to.be.true;
expect(changeHandler.getCall(0).args[0].isTrusted).to.be.false;
expect(self.axm.get()).to.be.eql({x: 100, y: 0, z:-100});
expect(self.axm.get()).to.be.eql({x: 100, y: 0, z: 145});
});
it("should check 'setTo' method (outside, duration)", (done) => {
// Given
Expand All @@ -191,7 +191,7 @@ describe("AnimationManager", function () {
"animationStart": startHandler,
"change": changeHandler,
"animationEnd": function(event) {
expect(self.axm.get()).to.be.eql({x: 100, y: 0, z:-100});
expect(self.axm.get()).to.be.eql({x: 100, y: 0, z:145});
expect(startHandler.callCount).to.be.equal(1);
expect(startHandler.getCall(0).args[0].isTrusted).to.be.false;
expect(changeHandler.called).to.be.true;
Expand Down Expand Up @@ -281,7 +281,7 @@ describe("AnimationManager", function () {
});

// When
const ret = this.inst.setTo(destPos, 0, true); // last (useCircular) param makes invalidating z-pos change(500)
const ret = this.inst.setTo(destPos, 0); // last (useCircular) param makes invalidating z-pos change(500)

// Then
setTimeout(() => {
Expand All @@ -295,11 +295,11 @@ describe("AnimationManager", function () {
it("should check 'setTo' method (diff position after range limit)", (done) => {
// Given
const depaPos = this.inst.axm.get();
const destPos = {x: -100, z: 500};
const destPos = {x: -100, z: 450};
const self = this.inst;
const changeHandler = sinon.spy(function(event) {
// Then
expect(self.axm.get()).to.be.eql({x: 0, y: 0, z: 200});
expect(self.axm.get()).to.be.eql({x: 0, y: 0, z: 150});
done();
});
this.component.on({
Expand Down

0 comments on commit 60de744

Please sign in to comment.