Skip to content

Commit 6033736

Browse files
fix(types): three r160 breaking changes (#332)
1 parent 45e22a1 commit 6033736

20 files changed

+155
-52
lines changed

src/controls/ArcballControls.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ class ArcballControls extends EventDispatcher {
370370
child.geometry = curveGeometry
371371
}
372372

373+
// @ts-ignore
373374
this.dispatchEvent(_changeEvent)
374375
}
375376

@@ -630,6 +631,7 @@ class ArcballControls extends EventDispatcher {
630631

631632
if (mouseOp) {
632633
event.preventDefault()
634+
// @ts-ignore
633635
this.dispatchEvent(_startEvent)
634636

635637
const notchDeltaY = 125 //distance of one notch of mouse wheel
@@ -681,7 +683,9 @@ class ArcballControls extends EventDispatcher {
681683

682684
this.updateTbState(STATE.IDLE, false)
683685

686+
// @ts-ignore
684687
this.dispatchEvent(_changeEvent)
688+
// @ts-ignore
685689
this.dispatchEvent(_endEvent)
686690

687691
break
@@ -748,7 +752,9 @@ class ArcballControls extends EventDispatcher {
748752

749753
this.updateTbState(STATE.IDLE, false)
750754

755+
// @ts-ignore
751756
this.dispatchEvent(_changeEvent)
757+
// @ts-ignore
752758
this.dispatchEvent(_endEvent)
753759

754760
break
@@ -759,6 +765,7 @@ class ArcballControls extends EventDispatcher {
759765

760766
private onSinglePanStart = (event: PointerEvent, operation: Operation): void => {
761767
if (this.enabled && this.domElement) {
768+
// @ts-ignore
762769
this.dispatchEvent(_startEvent)
763770

764771
this.setCenter(event.clientX, event.clientY)
@@ -773,6 +780,7 @@ class ArcballControls extends EventDispatcher {
773780
this._timeStart = -1
774781

775782
this.activateGizmos(false)
783+
// @ts-ignore
776784
this.dispatchEvent(_changeEvent)
777785
}
778786

@@ -784,6 +792,7 @@ class ArcballControls extends EventDispatcher {
784792
}
785793
if (this.enableGrid) {
786794
this.drawGrid()
795+
// @ts-ignore
787796
this.dispatchEvent(_changeEvent)
788797
}
789798
}
@@ -816,6 +825,7 @@ class ArcballControls extends EventDispatcher {
816825
}
817826
}
818827

828+
// @ts-ignore
819829
this.dispatchEvent(_changeEvent)
820830
break
821831

@@ -829,6 +839,7 @@ class ArcballControls extends EventDispatcher {
829839
this._timeStart = -1
830840

831841
this.activateGizmos(false)
842+
// @ts-ignore
832843
this.dispatchEvent(_changeEvent)
833844
}
834845

@@ -847,6 +858,7 @@ class ArcballControls extends EventDispatcher {
847858
this._timeStart = -1
848859

849860
this.activateGizmos(false)
861+
// @ts-ignore
850862
this.dispatchEvent(_changeEvent)
851863
}
852864

@@ -869,7 +881,9 @@ class ArcballControls extends EventDispatcher {
869881
if (restart) {
870882
//switch to pan operation
871883

884+
// @ts-ignore
872885
this.dispatchEvent(_endEvent)
886+
// @ts-ignore
873887
this.dispatchEvent(_startEvent)
874888

875889
this.updateTbState(opState, true)
@@ -899,7 +913,9 @@ class ArcballControls extends EventDispatcher {
899913
if (restart) {
900914
//switch to rotate operation
901915

916+
// @ts-ignore
902917
this.dispatchEvent(_endEvent)
918+
// @ts-ignore
903919
this.dispatchEvent(_startEvent)
904920

905921
this.updateTbState(opState, true)
@@ -965,7 +981,9 @@ class ArcballControls extends EventDispatcher {
965981
if (restart) {
966982
//switch to zoom operation
967983

984+
// @ts-ignore
968985
this.dispatchEvent(_endEvent)
986+
// @ts-ignore
969987
this.dispatchEvent(_startEvent)
970988

971989
this.updateTbState(opState, true)
@@ -1003,7 +1021,9 @@ class ArcballControls extends EventDispatcher {
10031021
if (restart) {
10041022
//switch to fov operation
10051023

1024+
// @ts-ignore
10061025
this.dispatchEvent(_endEvent)
1026+
// @ts-ignore
10071027
this.dispatchEvent(_startEvent)
10081028

10091029
this.updateTbState(opState, true)
@@ -1065,6 +1085,7 @@ class ArcballControls extends EventDispatcher {
10651085
break
10661086
}
10671087

1088+
// @ts-ignore
10681089
this.dispatchEvent(_changeEvent)
10691090
}
10701091
}
@@ -1092,11 +1113,13 @@ class ArcballControls extends EventDispatcher {
10921113
//cursor has been standing still for over 120 ms since last movement
10931114
this.updateTbState(STATE.IDLE, false)
10941115
this.activateGizmos(false)
1116+
// @ts-ignore
10951117
this.dispatchEvent(_changeEvent)
10961118
}
10971119
} else {
10981120
this.updateTbState(STATE.IDLE, false)
10991121
this.activateGizmos(false)
1122+
// @ts-ignore
11001123
this.dispatchEvent(_changeEvent)
11011124
}
11021125
} else if (this._state == STATE.PAN || this._state == STATE.IDLE) {
@@ -1107,14 +1130,17 @@ class ArcballControls extends EventDispatcher {
11071130
}
11081131

11091132
this.activateGizmos(false)
1133+
// @ts-ignore
11101134
this.dispatchEvent(_changeEvent)
11111135
}
11121136

1137+
// @ts-ignore
11131138
this.dispatchEvent(_endEvent)
11141139
}
11151140

11161141
private onDoubleTap = (event: PointerEvent): void => {
11171142
if (this.enabled && this.enablePan && this.scene && this.camera && this.domElement) {
1143+
// @ts-ignore
11181144
this.dispatchEvent(_startEvent)
11191145

11201146
this.setCenter(event.clientX, event.clientY)
@@ -1135,15 +1161,18 @@ class ArcballControls extends EventDispatcher {
11351161
this.updateTbState(STATE.FOCUS, true)
11361162
this.focus(hitP, this.scaleFactor)
11371163
this.updateTbState(STATE.IDLE, false)
1164+
// @ts-ignore
11381165
this.dispatchEvent(_changeEvent)
11391166
}
11401167
}
11411168

1169+
// @ts-ignore
11421170
this.dispatchEvent(_endEvent)
11431171
}
11441172

11451173
private onDoublePanStart = (): void => {
11461174
if (this.enabled && this.enablePan && this.camera && this.domElement) {
1175+
// @ts-ignore
11471176
this.dispatchEvent(_startEvent)
11481177

11491178
this.updateTbState(STATE.PAN, true)
@@ -1178,17 +1207,20 @@ class ArcballControls extends EventDispatcher {
11781207
const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true)
11791208
if (rayDir !== undefined) this._currentCursorPosition.copy(rayDir)
11801209
this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition, true))
1210+
// @ts-ignore
11811211
this.dispatchEvent(_changeEvent)
11821212
}
11831213
}
11841214

11851215
private onDoublePanEnd = (): void => {
11861216
this.updateTbState(STATE.IDLE, false)
1217+
// @ts-ignore
11871218
this.dispatchEvent(_endEvent)
11881219
}
11891220

11901221
private onRotateStart = (): void => {
11911222
if (this.enabled && this.enableRotate) {
1223+
// @ts-ignore
11921224
this.dispatchEvent(_startEvent)
11931225

11941226
this.updateTbState(STATE.ZROTATE, true)
@@ -1241,18 +1273,21 @@ class ArcballControls extends EventDispatcher {
12411273
if (rotationPoint !== undefined) {
12421274
this.applyTransformMatrix(this.zRotate(rotationPoint, amount))
12431275
}
1276+
// @ts-ignore
12441277
this.dispatchEvent(_changeEvent)
12451278
}
12461279
}
12471280

12481281
private onRotateEnd = (): void => {
12491282
this.updateTbState(STATE.IDLE, false)
12501283
this.activateGizmos(false)
1284+
// @ts-ignore
12511285
this.dispatchEvent(_endEvent)
12521286
}
12531287

12541288
private onPinchStart = (): void => {
12551289
if (this.enabled && this.enableZoom) {
1290+
// @ts-ignore
12561291
this.dispatchEvent(_startEvent)
12571292
this.updateTbState(STATE.SCALE, true)
12581293

@@ -1302,17 +1337,20 @@ class ArcballControls extends EventDispatcher {
13021337
if (scalePoint !== undefined) {
13031338
this.applyTransformMatrix(this.applyScale(amount, scalePoint))
13041339
}
1340+
// @ts-ignore
13051341
this.dispatchEvent(_changeEvent)
13061342
}
13071343
}
13081344

13091345
private onPinchEnd = (): void => {
13101346
this.updateTbState(STATE.IDLE, false)
1347+
// @ts-ignore
13111348
this.dispatchEvent(_endEvent)
13121349
}
13131350

13141351
private onTriplePanStart = (): void => {
13151352
if (this.enabled && this.enableZoom && this.domElement) {
1353+
// @ts-ignore
13161354
this.dispatchEvent(_startEvent)
13171355

13181356
this.updateTbState(STATE.SCALE, true)
@@ -1401,12 +1439,14 @@ class ArcballControls extends EventDispatcher {
14011439
.multiplyScalar(newDistance / x)
14021440
this._m4_1.makeTranslation(direction.x, direction.y, direction.z)
14031441

1442+
// @ts-ignore
14041443
this.dispatchEvent(_changeEvent)
14051444
}
14061445
}
14071446

14081447
private onTriplePanEnd = (): void => {
14091448
this.updateTbState(STATE.IDLE, false)
1449+
// @ts-ignore
14101450
this.dispatchEvent(_endEvent)
14111451
//this.dispatchEvent( _changeEvent );
14121452
}
@@ -1933,6 +1973,7 @@ class ArcballControls extends EventDispatcher {
19331973
*/
19341974
public setGizmosVisible(value: boolean): void {
19351975
this._gizmos.visible = value
1976+
// @ts-ignore
19361977
this.dispatchEvent(_changeEvent)
19371978
}
19381979

@@ -2017,6 +2058,7 @@ class ArcballControls extends EventDispatcher {
20172058
this.updateTbState(STATE.IDLE, false)
20182059
this.activateGizmos(false)
20192060

2061+
// @ts-ignore
20202062
this.dispatchEvent(_changeEvent)
20212063
} else {
20222064
const amount = this.easeOutCubic(animTime)
@@ -2025,6 +2067,7 @@ class ArcballControls extends EventDispatcher {
20252067
this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale)
20262068
this.focus(point, size, amount)
20272069

2070+
// @ts-ignore
20282071
this.dispatchEvent(_changeEvent)
20292072
const self = this
20302073
this._animationId = window.requestAnimationFrame(function (t) {
@@ -2062,6 +2105,7 @@ class ArcballControls extends EventDispatcher {
20622105
//tetha = 0.5 * alpha * t^2 + w0 * t + tetha0
20632106
this._angleCurrent = 0.5 * -this.dampingFactor * Math.pow(deltaTime, 2) + w0 * deltaTime + 0
20642107
this.applyTransformMatrix(this.rotate(rotationAxis, this._angleCurrent))
2108+
// @ts-ignore
20652109
this.dispatchEvent(_changeEvent)
20662110
const self = this
20672111
this._animationId = window.requestAnimationFrame(function (t) {
@@ -2074,6 +2118,7 @@ class ArcballControls extends EventDispatcher {
20742118
this.updateTbState(STATE.IDLE, false)
20752119
this.activateGizmos(false)
20762120

2121+
// @ts-ignore
20772122
this.dispatchEvent(_changeEvent)
20782123
}
20792124
} else {
@@ -2084,6 +2129,7 @@ class ArcballControls extends EventDispatcher {
20842129

20852130
if (this._state != STATE.ROTATE) {
20862131
this.activateGizmos(false)
2132+
// @ts-ignore
20872133
this.dispatchEvent(_changeEvent)
20882134
}
20892135
}
@@ -2156,6 +2202,7 @@ class ArcballControls extends EventDispatcher {
21562202

21572203
this.updateTbState(STATE.IDLE, false)
21582204

2205+
// @ts-ignore
21592206
this.dispatchEvent(_changeEvent)
21602207
}
21612208
}
@@ -2774,6 +2821,7 @@ class ArcballControls extends EventDispatcher {
27742821
this.camera.lookAt(this._gizmos.position)
27752822
this.updateTbState(STATE.IDLE, false)
27762823

2824+
// @ts-ignore
27772825
this.dispatchEvent(_changeEvent)
27782826
}
27792827
}

src/controls/DeviceOrientationControls.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class DeviceOrientationControls extends EventDispatcher {
103103

104104
if (8 * (1 - this.lastQuaternion.dot(this.object.quaternion)) > this.EPS) {
105105
this.lastQuaternion.copy(this.object.quaternion)
106+
// @ts-ignore
106107
this.dispatchEvent(this.changeEvent)
107108
}
108109
}

src/controls/DragControls.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class DragControls extends EventDispatcher {
7272
this._selected.position.copy(this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix))
7373
}
7474

75+
// @ts-ignore
7576
this.dispatchEvent({ type: 'drag', object: this._selected })
7677

7778
return
@@ -91,13 +92,15 @@ class DragControls extends EventDispatcher {
9192
)
9293

9394
if (this._hovered !== object) {
95+
// @ts-ignore
9496
this.dispatchEvent({ type: 'hoveron', object })
9597

9698
this._domElement.style.cursor = 'pointer'
9799
this._hovered = object
98100
}
99101
} else {
100102
if (this._hovered !== null) {
103+
// @ts-ignore
101104
this.dispatchEvent({ type: 'hoveroff', object: this._hovered })
102105

103106
this._domElement.style.cursor = 'auto'
@@ -122,12 +125,14 @@ class DragControls extends EventDispatcher {
122125

123126
this._domElement.style.cursor = 'move'
124127

128+
// @ts-ignore
125129
this.dispatchEvent({ type: 'dragstart', object: this._selected })
126130
}
127131
}
128132

129133
private onMouseCancel = (): void => {
130134
if (this._selected) {
135+
// @ts-ignore
131136
this.dispatchEvent({ type: 'dragend', object: this._selected })
132137

133138
this._selected = null
@@ -185,6 +190,7 @@ class DragControls extends EventDispatcher {
185190
this._selected.position.copy(this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix))
186191
}
187192

193+
// @ts-ignore
188194
this.dispatchEvent({ type: 'drag', object: this._selected })
189195

190196
return
@@ -220,6 +226,7 @@ class DragControls extends EventDispatcher {
220226

221227
this._domElement.style.cursor = 'move'
222228

229+
// @ts-ignore
223230
this.dispatchEvent({ type: 'dragstart', object: this._selected })
224231
}
225232
}
@@ -228,6 +235,7 @@ class DragControls extends EventDispatcher {
228235
event.preventDefault()
229236

230237
if (this._selected) {
238+
// @ts-ignore
231239
this.dispatchEvent({ type: 'dragend', object: this._selected })
232240

233241
this._selected = null

0 commit comments

Comments
 (0)