mirror of
https://github.com/LucasDower/ObjToSchematic.git
synced 2024-12-27 03:18:59 +08:00
Added camera reset button
This commit is contained in:
parent
2dfb232628
commit
df2eff7e1f
9
resources/static/centre.svg
Normal file
9
resources/static/centre.svg
Normal file
@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-focus-2" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="#00abfb" fill="none" stroke-linecap="round" stroke-linejoin="round" id="centre-svg">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
||||
<circle cx="12" cy="12" r=".5" fill="currentColor" />
|
||||
<circle cx="12" cy="12" r="7" />
|
||||
<line x1="12" y1="3" x2="12" y2="5" />
|
||||
<line x1="3" y1="12" x2="5" y2="12" />
|
||||
<line x1="12" y1="19" x2="12" y2="21" />
|
||||
<line x1="19" y1="12" x2="21" y2="12" />
|
||||
</svg>
|
After Width: | Height: | Size: 559 B |
@ -149,6 +149,13 @@ export class ArcballCamera {
|
||||
this._distance.addToTarget(-1);
|
||||
}
|
||||
|
||||
public reset() {
|
||||
this._target.setTarget(new Vector3(0, 0, 0));
|
||||
this._distance.setTarget(18.0);
|
||||
this._azimuth.setTarget(-1.0);
|
||||
this._elevation.setTarget(1.3);
|
||||
}
|
||||
|
||||
/*
|
||||
public getMouseRay() {
|
||||
const mousePos = this.mouseManager.getMousePosNorm();
|
||||
|
@ -162,8 +162,11 @@ export class UI {
|
||||
'zoomIn': new ToolbarItemElement('plus', () => {
|
||||
ArcballCamera.Get.onZoomIn();
|
||||
}),
|
||||
'centre': new ToolbarItemElement('centre', () => {
|
||||
ArcballCamera.Get.reset();
|
||||
}),
|
||||
},
|
||||
elementsOrder: ['zoomOut', 'zoomIn'],
|
||||
elementsOrder: ['zoomOut', 'zoomIn', 'centre'],
|
||||
},
|
||||
/*
|
||||
'camera': {
|
||||
|
@ -306,6 +306,10 @@ export class SmoothVariable {
|
||||
this._target = clamp(this._target + delta, this._min, this._max);
|
||||
}
|
||||
|
||||
public setTarget(target: number) {
|
||||
this._target = target;
|
||||
}
|
||||
|
||||
public tick() {
|
||||
this._actual += (this._target - this._actual) * this._smoothing;
|
||||
}
|
||||
@ -334,6 +338,10 @@ export class SmoothVectorVariable {
|
||||
this._target = Vector3.add(this._target, delta);
|
||||
}
|
||||
|
||||
public setTarget(target: Vector3) {
|
||||
this._target = target;
|
||||
}
|
||||
|
||||
public tick() {
|
||||
this._actual.add(Vector3.sub(this._target, this._actual).mulScalar(this._smoothing));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user