Skip to content

Commit

Permalink
remove __implXxx, fix tilt control (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew44-mappable authored Apr 25, 2024
1 parent ca56943 commit 9290d8a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 35 deletions.
14 changes: 7 additions & 7 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 @@ -19,7 +19,7 @@
},
"devDependencies": {
"@mappable-world/mappable-cli": "^0.0.32",
"@mappable-world/mappable-types": "^0.0.16",
"@mappable-world/mappable-types": "^0.0.18",
"@types/got": "9.6.12",
"@types/jest": "29.5.3",
"@types/jsdom": "21.1.1",
Expand Down
4 changes: 0 additions & 4 deletions src/controls/MMapGeolocationControl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ class MMapGeolocationControl extends mappable.MMapGroupEntity<MMapGeolocationCon
this._handleGeolocationClick = this._handleGeolocationClick.bind(this);
}

protected __implGetDefaultProps(): DefaultProps {
return MMapGeolocationControl.defaultProps;
}

private _timeout: number;
private _setLoading(loading: boolean): void {
this._loading = loading;
Expand Down
4 changes: 0 additions & 4 deletions src/controls/MMapRotateControl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export class MMapRotateControl extends mappable.MMapComplexEntity<MMapRotateCont
private _control!: MMapControl;
private _rotateControl!: InternalRotateControl;

protected __implGetDefaultProps() {
return MMapRotateControl.defaultProps;
}

constructor(props: MMapRotateControlProps) {
super(props);
}
Expand Down
6 changes: 3 additions & 3 deletions src/controls/MMapRotateTiltControl/MMapTiltControl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {MMapListener} from '@mappable-world/mappable-types';
import {MMapCameraRequest} from '@mappable-world/mappable-types/imperative/MMap';
import type {MMapRotateTiltControlProps} from '.';
import {CLICK_TOLERANCE_PX, Position, degToRad, radToDeg, toggleTilt} from '../utils/angle-utils';
import {CLICK_TOLERANCE_PX, Position, radToDeg, toggleTilt} from '../utils/angle-utils';
import './MMapTiltControl.css';

const TILT_CONTROL_CLASS = 'mappable--rotate-tilt_tilt';
Expand Down Expand Up @@ -54,8 +54,8 @@ export class MMapTiltControl extends mappable.MMapComplexEntity<MMapRotateTiltCo
tilt,
tiltRange: {max, min}
} = this.root;
const targetTiltDeg = toggleTilt(radToDeg(tilt), min, max);
this.root.setCamera({tilt: degToRad(targetTiltDeg), duration, easing});
const targetTiltDeg = toggleTilt(tilt, min, max);
this.root.setCamera({tilt: targetTiltDeg, duration, easing});
};

private _onTiltStart = (event: MouseEvent) => {
Expand Down
4 changes: 0 additions & 4 deletions src/controls/MMapRotateTiltControl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export class MMapRotateTiltControl extends mappable.MMapComplexEntity<MMapRotate
private _tiltControl!: MMapTiltControl;
private _control!: MMapControl;

protected __implGetDefaultProps() {
return MMapRotateTiltControl.defaultProps;
}

constructor(props: MMapRotateTiltControlProps) {
super(props);
}
Expand Down
10 changes: 3 additions & 7 deletions src/controls/MMapTiltControl/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {EasingFunctionDescription, MMapControl, MMapListener} from '@mappable-world/mappable-types';
import {MMapCameraRequest} from '@mappable-world/mappable-types/imperative/MMap';
import {CLICK_TOLERANCE_PX, Position, degToRad, radToDeg, toggleTilt} from '../utils/angle-utils';
import {CLICK_TOLERANCE_PX, Position, radToDeg, toggleTilt} from '../utils/angle-utils';
import {MMapTiltControlVuefyOptions} from './vue';

import './index.css';
Expand Down Expand Up @@ -39,10 +39,6 @@ export class MMapTiltControl extends mappable.MMapComplexEntity<MMapTiltControlP
super(props);
}

protected __implGetDefaultProps() {
return MMapTiltControl.defaultProps;
}

protected _onAttach(): void {
this._control = new mappable.MMapControl({transparent: true});
this._tiltControl = new InternalTiltControl(this._props);
Expand Down Expand Up @@ -123,8 +119,8 @@ class InternalTiltControl extends mappable.MMapComplexEntity<MMapTiltControlProp
tilt,
tiltRange: {min, max}
} = this.root;
const targetTiltDeg = toggleTilt(radToDeg(tilt), min, max);
this.root.setCamera({tilt: degToRad(targetTiltDeg), duration, easing});
const targetTiltDeg = toggleTilt(tilt, min, max);
this.root.setCamera({tilt: targetTiltDeg, duration, easing});
};

private _onTiltStart = (event: MouseEvent) => {
Expand Down
6 changes: 1 addition & 5 deletions src/controls/MMapZoomControl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,14 @@ class MMapZoomCommonControl extends mappable.MMapGroupEntity<MMapZoomControlProp
* map.addChild(controls);
* ```
*/
class MMapZoomControl extends mappable.MMapComplexEntity<MMapZoomControlProps> {
class MMapZoomControl extends mappable.MMapComplexEntity<MMapZoomControlProps, DefaultProps> {
static [mappable.optionsKeyVuefy] = MMapZoomControlVuefyOptions;

static defaultProps = defaultProps;

private _control!: MMapControl;
private _zoom!: MMapZoomCommonControl;

protected __implGetDefaultProps(): DefaultProps {
return MMapZoomControl.defaultProps;
}

protected override _onAttach(): void {
this._zoom = new MMapZoomCommonControl(this._props);
this._control = new mappable.MMapControl().addChild(this._zoom);
Expand Down

0 comments on commit 9290d8a

Please sign in to comment.