Skip to content

Commit c4128ed

Browse files
committed
fix(soba): bind offset to position on pivot controls instead of effect
1 parent 909b27c commit c4128ed

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

libs/soba/gizmos/src/lib/pivot-controls/pivot-controls.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,7 @@ import {
88
output,
99
viewChild,
1010
} from '@angular/core';
11-
import {
12-
applyProps,
13-
extend,
14-
getLocalState,
15-
injectBeforeRender,
16-
injectStore,
17-
NgtAnyRecord,
18-
omit,
19-
pick,
20-
} from 'angular-three';
11+
import { extend, getLocalState, injectBeforeRender, injectStore, NgtAnyRecord, omit, pick } from 'angular-three';
2112
import { calculateScaleFactor } from 'angular-three-soba/misc';
2213
import { mergeInputs } from 'ngxtension/inject-inputs';
2314
import { Box3, Group, Matrix4, Mesh, Vector3 } from 'three';
@@ -137,7 +128,7 @@ const defaultOptions: NgtsPivotControlsOptions = {
137128
template: `
138129
<ngt-group #parent>
139130
<ngt-group #group [matrix]="matrix()" [matrixAutoUpdate]="false" [parameters]="parameters()">
140-
<ngt-group #gizmo [visible]="visible()" [rotation]="rotation()">
131+
<ngt-group #gizmo [visible]="visible()" [position]="offset()" [rotation]="rotation()">
141132
@if (enabled()) {
142133
@let _disableAxes = disableAxes();
143134
@let _disableSliders = disableSliders();
@@ -277,17 +268,6 @@ export class NgtsPivotControls {
277268
constructor() {
278269
extend({ Group });
279270

280-
effect(() => {
281-
const [anchor, offset] = [this.anchor(), this.offset()];
282-
// if there is anchor, then the below effect will handle the position
283-
if (anchor) return;
284-
// if not, then we'll use the offset to set the position for gizmo
285-
const gizmo = this.gizmoRef().nativeElement;
286-
if (!gizmo) return;
287-
288-
applyProps(gizmo, { position: offset });
289-
});
290-
291271
effect(() => {
292272
const anchor = this.anchor();
293273
if (!anchor) return;

0 commit comments

Comments
 (0)