Skip to content

Commit 03dcfb8

Browse files
committed
feat(soba): gizmos
1 parent a88606b commit 03dcfb8

File tree

4 files changed

+62
-46
lines changed

4 files changed

+62
-46
lines changed

.ws-context

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"framework": "angular",
3-
"angular-template-syntax": "V_17",
3+
"angular-template-syntax": "V_18_1",
44
"apps/**/*.analog": {
55
"framework": "angular",
6-
"angular-template-syntax": "V_17"
6+
"angular-template-syntax": "V_18_1"
77
}
88
}
99

libs/soba/gizmos/src/lib/gizmo-helper/gizmo-helper.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ const defaultOptions: NgtsGizmoHelperOptions = {
6363
selector: 'ngts-gizmo-helper',
6464
standalone: true,
6565
template: `
66+
@let _renderPriority = renderPriority();
67+
6668
<ngt-portal
6769
[container]="scene"
6870
[autoRender]="true"
69-
[autoRenderPriority]="renderPriority()"
70-
[state]="{ events: { priority: renderPriority() + 1 } }"
71+
[autoRenderPriority]="_renderPriority"
72+
[state]="{ events: { priority: _renderPriority + 1 } }"
7173
>
7274
<ng-template portalContent let-injector="injector" let-container="container">
7375
<ngts-orthographic-camera [options]="{ makeDefault: true, position: [0, 0, 200] }" />

libs/soba/gizmos/src/lib/gizmo-helper/gizmo-viewport.ts

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -189,63 +189,71 @@ const defaultOptions: NgtsGizmoViewportOptions = {
189189
selector: 'ngts-gizmo-viewport',
190190
standalone: true,
191191
template: `
192+
@let _axisScale = axisScale();
193+
@let _axisHeadScale = axisHeadScale();
194+
@let _labels = labels();
195+
@let _labelColor = labelColor();
196+
@let _axisColors = axisColors();
197+
@let _font = font();
198+
@let _disabled = disabled();
199+
192200
<ngt-group [scale]="40" [parameters]="parameters()">
193-
<viewport-axis [color]="axisColors()[0]" [rotation]="[0, 0, 0]" [scale]="axisScale()" />
194-
<viewport-axis [color]="axisColors()[1]" [rotation]="[0, 0, Math.PI / 2]" [scale]="axisScale()" />
195-
<viewport-axis [color]="axisColors()[2]" [rotation]="[0, -Math.PI / 2, 0]" [scale]="axisScale()" />
201+
<viewport-axis [color]="_axisColors[0]" [rotation]="[0, 0, 0]" [scale]="_axisScale" />
202+
<viewport-axis [color]="_axisColors[1]" [rotation]="[0, 0, Math.PI / 2]" [scale]="_axisScale" />
203+
<viewport-axis [color]="_axisColors[2]" [rotation]="[0, -Math.PI / 2, 0]" [scale]="_axisScale" />
196204
197205
@if (!hideAxisHeads()) {
198206
<viewport-axis-head
199-
[arcStyle]="axisColors()[0]"
207+
[arcStyle]="_axisColors[0]"
200208
[position]="[1, 0, 0]"
201-
[label]="labels()[0]"
202-
[labelColor]="labelColor()"
203-
[axisHeadScale]="axisHeadScale()"
204-
[disabled]="disabled()"
205-
[font]="font()"
209+
[label]="_labels[0]"
210+
[labelColor]="_labelColor"
211+
[axisHeadScale]="_axisHeadScale"
212+
[disabled]="_disabled"
213+
[font]="_font"
206214
[onClick]="onClick"
207215
/>
208216
<viewport-axis-head
209-
[arcStyle]="axisColors()[1]"
217+
[arcStyle]="_axisColors[1]"
210218
[position]="[0, 1, 0]"
211-
[label]="labels()[1]"
212-
[labelColor]="labelColor()"
213-
[axisHeadScale]="axisHeadScale()"
214-
[disabled]="disabled()"
215-
[font]="font()"
219+
[label]="_labels[1]"
220+
[labelColor]="_labelColor"
221+
[axisHeadScale]="_axisHeadScale"
222+
[disabled]="_disabled"
223+
[font]="_font"
216224
[onClick]="onClick"
217225
/>
218226
<viewport-axis-head
219-
[arcStyle]="axisColors()[2]"
227+
[arcStyle]="_axisColors[2]"
220228
[position]="[0, 0, 1]"
221-
[label]="labels()[2]"
222-
[labelColor]="labelColor()"
223-
[axisHeadScale]="axisHeadScale()"
224-
[disabled]="disabled()"
225-
[font]="font()"
229+
[label]="_labels[2]"
230+
[labelColor]="_labelColor"
231+
[axisHeadScale]="_axisHeadScale"
232+
[disabled]="_disabled"
233+
[font]="_font"
226234
[onClick]="onClick"
227235
/>
228236
229237
@if (!hideNegativeAxes()) {
230238
<viewport-axis-head
231-
[arcStyle]="axisColors()[0]"
239+
[arcStyle]="_axisColors[0]"
232240
[position]="[-1, 0, 0]"
233-
[axisHeadScale]="axisHeadScale()"
234-
[disabled]="disabled()"
241+
[axisHeadScale]="_axisHeadScale"
242+
[disabled]="_disabled"
235243
[onClick]="onClick"
236244
/>
237245
<viewport-axis-head
238-
[arcStyle]="axisColors()[1]"
246+
[arcStyle]="_axisColors[1]"
239247
[position]="[0, -1, 0]"
240-
[axisHeadScale]="axisHeadScale()"
241-
[disabled]="disabled()"
248+
[axisHeadScale]="_axisHeadScale"
249+
[disabled]="_disabled"
242250
[onClick]="onClick"
243251
/>
244252
<viewport-axis-head
245-
[arcStyle]="axisColors()[2]"
253+
[arcStyle]="_axisColors[2]"
246254
[position]="[0, 0, -1]"
247-
[axisHeadScale]="axisHeadScale()"
248-
[disabled]="disabled()"
255+
[axisHeadScale]="_axisHeadScale"
256+
[disabled]="_disabled"
249257
[onClick]="onClick"
250258
/>
251259
}

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,43 +131,49 @@ const defaultOptions: NgtsPivotControlsOptions = {
131131
<ngt-group #group [matrix]="matrix()" [matrixAutoUpdate]="false" [parameters]="parameters()">
132132
<ngt-group #gizmo [visible]="visible()" [position]="offset()" [rotation]="rotation()">
133133
@if (enabled()) {
134-
@if (!disableAxes() && activeAxes()[0]) {
134+
@let _disableAxes = disableAxes();
135+
@let _disableSliders = disableSliders();
136+
@let _disableRotations = disableRotations();
137+
@let _disableScaling = disableScaling();
138+
@let _activeAxes = activeAxes();
139+
140+
@if (!_disableAxes && _activeAxes[0]) {
135141
<ngts-axis-arrow [axis]="0" [direction]="xDir" />
136142
}
137-
@if (!disableAxes() && activeAxes()[1]) {
143+
@if (!_disableAxes && _activeAxes[1]) {
138144
<ngts-axis-arrow [axis]="1" [direction]="yDir" />
139145
}
140-
@if (!disableAxes() && activeAxes()[2]) {
146+
@if (!_disableAxes && _activeAxes[2]) {
141147
<ngts-axis-arrow [axis]="2" [direction]="zDir" />
142148
}
143149
144-
@if (!disableSliders() && activeAxes()[0] && activeAxes()[1]) {
150+
@if (!_disableSliders && _activeAxes[0] && _activeAxes[1]) {
145151
<ngts-plane-slider [axis]="2" [dir1]="xDir" [dir2]="yDir" />
146152
}
147-
@if (!disableSliders() && activeAxes()[0] && activeAxes()[2]) {
153+
@if (!_disableSliders && _activeAxes[0] && _activeAxes[2]) {
148154
<ngts-plane-slider [axis]="1" [dir1]="zDir" [dir2]="xDir" />
149155
}
150-
@if (!disableSliders() && activeAxes()[2] && activeAxes()[1]) {
156+
@if (!_disableSliders && _activeAxes[2] && _activeAxes[1]) {
151157
<ngts-plane-slider [axis]="0" [dir1]="yDir" [dir2]="zDir" />
152158
}
153159
154-
@if (!disableRotations() && activeAxes()[0] && activeAxes()[1]) {
160+
@if (!_disableRotations && _activeAxes[0] && _activeAxes[1]) {
155161
<ngts-axis-rotator [axis]="2" [dir1]="xDir" [dir2]="yDir" />
156162
}
157-
@if (!disableRotations() && activeAxes()[0] && activeAxes()[2]) {
163+
@if (!_disableRotations && _activeAxes[0] && _activeAxes[2]) {
158164
<ngts-axis-rotator [axis]="1" [dir1]="zDir" [dir2]="xDir" />
159165
}
160-
@if (!disableRotations() && activeAxes()[2] && activeAxes()[1]) {
166+
@if (!_disableRotations && _activeAxes[2] && _activeAxes[1]) {
161167
<ngts-axis-rotator [axis]="0" [dir1]="yDir" [dir2]="zDir" />
162168
}
163169
164-
@if (!disableScaling() && activeAxes()[0]) {
170+
@if (!_disableScaling && _activeAxes[0]) {
165171
<ngts-scaling-sphere [axis]="0" [direction]="xDir" />
166172
}
167-
@if (!disableScaling() && activeAxes()[1]) {
173+
@if (!_disableScaling && _activeAxes[1]) {
168174
<ngts-scaling-sphere [axis]="1" [direction]="yDir" />
169175
}
170-
@if (!disableScaling() && activeAxes()[2]) {
176+
@if (!_disableScaling && _activeAxes[2]) {
171177
<ngts-scaling-sphere [axis]="2" [direction]="zDir" />
172178
}
173179
}

0 commit comments

Comments
 (0)