Skip to content

Commit

Permalink
chore: update @egjs/axes to 3.3.0 (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
malangfox authored Jun 16, 2022
1 parent b2bcb47 commit 6b9b2eb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 70 deletions.
65 changes: 11 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"url": "https://github.com/naver/egjs-view360/issues"
},
"dependencies": {
"@egjs/axes": "^2.7.1",
"@egjs/axes": "^3.3.0",
"@egjs/component": "^3.0.1",
"@egjs/imready": "^1.1.2",
"gl-matrix": "^3.3.0",
Expand Down
15 changes: 5 additions & 10 deletions src/YawPitchControl/input/RotationPanInput.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import Axes, { PanInput } from "@egjs/axes";
import { IInputTypeObserver } from "@egjs/axes/declaration/inputType/InputType";
import { InputTypeObserver } from "@egjs/axes/declaration/inputType/InputType";
import { PanInputOption } from "@egjs/axes/declaration/inputType/PanInput";

import ScreenRotationAngle from "../ScreenRotationAngle";
Expand All @@ -14,7 +13,6 @@ import ScreenRotationAngle from "../ScreenRotationAngle";
* Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.
* @extends PanInput
*/
// @ts-ignore
export default class RotationPanInput extends PanInput {
private _useRotation: boolean;
private _screenRotationAngle: ScreenRotationAngle | null;
Expand Down Expand Up @@ -51,7 +49,7 @@ export default class RotationPanInput extends PanInput {
}
}

public connect(observer: IInputTypeObserver) {
public connect(observer: InputTypeObserver) {
// User intetened direction
this._userDirection = this._direction;

Expand All @@ -73,15 +71,12 @@ export default class RotationPanInput extends PanInput {
super.destroy();
}

// eslint-disable-next-line @typescript-eslint/naming-convention
private getOffset(properties: number[], useDirection: boolean[]) {
protected _getOffset(properties: number[], useDirection: boolean[]) {
if (this._useRotation === false) {
// @ts-ignore
return super.getOffset(properties, useDirection);
return super._getOffset(properties, useDirection);
}

// @ts-ignore
const offset = super.getOffset(properties, [true, true]);
const offset = super._getOffset(properties, [true, true]);
const newOffset = [0, 0];

const theta = this._screenRotationAngle!.getRadian();
Expand Down
6 changes: 3 additions & 3 deletions src/YawPitchControl/input/TiltMotionInput.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from "@egjs/component";
import { quat } from "gl-matrix";
import { IInputTypeObserver } from "@egjs/axes/declaration/inputType/InputType";
import { InputTypeObserver } from "@egjs/axes/declaration/inputType/InputType";

import { toAxis } from "../utils";
import { util, ROTATE_CONSTANT } from "../../utils/math-util";
Expand All @@ -27,7 +27,7 @@ export default class TiltMotionInput extends Component<{}> {
public options: { scale: number; threshold: number };
public fusionPoseSensor: FusionPoseSensor | null;
public axes: string[];
public observer: IInputTypeObserver | null;
public observer: InputTypeObserver | null;

private _prevQuaternion: quat | null;
private _quaternion: quat | null;
Expand Down Expand Up @@ -55,7 +55,7 @@ export default class TiltMotionInput extends Component<{}> {
this.axes = axes;
}

public connect(observer: IInputTypeObserver) {
public connect(observer: InputTypeObserver) {
if (this.observer) {
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/YawPitchControl/RotationPanInput.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("RotationPanInput", () => {
// When
const scale = this.inst.options.scale;
const inputProperties = [10, 10];
const result = this.inst.getOffset(inputProperties, [true, true]);
const result = this.inst._getOffset(inputProperties, [true, true]);

// Then
const expected = inputProperties.map((input, index) => input * scale[index]);
Expand Down Expand Up @@ -83,7 +83,7 @@ describe("RotationPanInput", () => {
// When
const scale = this.inst.options.scale;
const input = [10, 10];
const result = this.inst.getOffset(input, [true, true]);
const result = this.inst._getOffset(input, [true, true]);

// Then
const expected = [
Expand Down

0 comments on commit 6b9b2eb

Please sign in to comment.