@things-factory/figure-ui 10.1.195 → 10.1.197

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -234,7 +234,7 @@ export class FigureEditor extends LitElement {
234
234
  aria-pressed=${String(this.gizmoMode === tool.mode)}
235
235
  ?disabled=${!tool.can}
236
236
  aria-label=${i18next.t('figure.button.gizmo-' + tool.mode)}
237
- title=${`${i18next.t('figure.button.gizmo-' + tool.mode)} (${tool.key})${tool.can || !this.selected ? '' : ' · ' + (tool.mode === 'scale' && this.sizeDragUnsure(this.asset()!, this.selected) ? this.sizeDragRefusalOf(this.selected) : i18next.t('figure.text.gizmo-not-own'))}`}
237
+ title=${`${i18next.t('figure.button.gizmo-' + tool.mode)} (${tool.key})${tool.can || !this.selected ? '' : ' · ' + (tool.mode === 'scale' && this.sizeDragTurned(this.asset()!, this.selected) ? this.sizeDragRefusalOf(this.selected) : i18next.t('figure.text.gizmo-not-own'))}`}
238
238
  @click=${() => this.useGizmo(tool.mode)}
239
239
  >
240
240
  <md-icon>${tool.icon}</md-icon>
@@ -320,12 +320,16 @@ export class FigureEditor extends LitElement {
320
320
  }
321
321
  /** The scene toggles: the mode already shown takes the gizmo away. */
322
322
  private useGizmo(mode: 'translate' | 'rotate' | 'scale') {
323
- if (mode === 'scale' && this.selected && this.gizmoMode !== 'scale') {
323
+ /*
324
+ R does what the bar's resize tool does: on a part whose size is not its own to drag the tool is off, so no gizmo is
325
+ put on it to drag in vain (:3300, 10.1.196) -- the tool's own words are said instead, and a part turned is sent to
326
+ its size fields.
327
+ */
328
+ if (mode === 'scale' && this.selected && this.gizmoMode !== 'scale' && !this.reachOf(this.selected).scale) {
324
329
  const asset = this.asset()
325
- if (asset && this.sizeDragUnsure(asset, this.selected)) {
326
- this.tellSizeByFields(this.selected)
327
- return
328
- }
330
+ if (asset && this.sizeDragTurned(asset, this.selected)) this.tellSizeByFields(this.selected)
331
+ else this.refusals.say(i18next.t('figure.text.gizmo-not-own'))
332
+ return
329
333
  }
330
334
  this.renderRoot.querySelector<FigureCanvas>('figure-canvas')?.gizmo(mode)
331
335
  this.gizmoMode = this.gizmoMode === mode ? undefined : mode
@@ -571,6 +575,19 @@ export class FigureEditor extends LitElement {
571
575
  return none
572
576
  }
573
577
  }
578
+ /**
579
+ * Whether this part's size is its own to drag but the drag is withheld because it is turned: then the size fields are
580
+ * the way, and the notice says so. A part whose size is worked out from another part or from the figure's size is not
581
+ * its own to drag at all; it is not told it is attached turned, nor sent to fields it cannot type in (:3300,
582
+ * 2026-10-19, the fan's blade-2). Its tool says it is placed by something else, as before.
583
+ */
584
+ private sizeDragTurned(asset: FigureAsset, id: string): boolean {
585
+ try {
586
+ return gizmoReachOf(asset, id).scale && this.sizeDragUnsure(asset, id)
587
+ } catch {
588
+ return false
589
+ }
590
+ }
574
591
  /** Whether a size drag on this part could not show what is written: figure-model gives no face it keeps. */
575
592
  private sizeDragUnsure(asset: FigureAsset, id: string): boolean {
576
593
  try {
@@ -626,7 +643,7 @@ export class FigureEditor extends LitElement {
626
643
  */
627
644
  const jointed = !!asset.joints?.some(j => j.body1.part === ownerOf(id))
628
645
  /* A size drag this part cannot show truly is not written: it springs back, and the reason is said. */
629
- if (result.scale && result.scale.some(k => Math.abs(k - 1) > 1e-4) && this.sizeDragUnsure(asset, id)) {
646
+ if (result.scale && result.scale.some(k => Math.abs(k - 1) > 1e-4) && this.sizeDragTurned(asset, id)) {
630
647
  this.tellSizeByFields(id)
631
648
  return this.requestUpdate()
632
649
  }
@@ -47,6 +47,11 @@ export class RefusalTeller {
47
47
  this.toldViewError = viewError
48
48
  }
49
49
 
50
+ /** What cannot be done, said once as a notice: nothing went wrong, and there is no other way to offer. */
51
+ say(message: string) {
52
+ notify({ level: 'info', message })
53
+ }
54
+
50
55
  /**
51
56
  * What cannot be done this way, with the way it can, as a notice: nothing went wrong, so not the error's red
52
57
  * (user 2026-10-19, the size drag on a part attached turned). Given more time than a plain notice, for its button.
@@ -183,6 +183,13 @@ export declare class FigureEditor extends LitElement {
183
183
  private designValues;
184
184
  /** What the gizmo may write for the selected part — read off the asset being edited. */
185
185
  private reachOf;
186
+ /**
187
+ * Whether this part's size is its own to drag but the drag is withheld because it is turned: then the size fields are
188
+ * the way, and the notice says so. A part whose size is worked out from another part or from the figure's size is not
189
+ * its own to drag at all; it is not told it is attached turned, nor sent to fields it cannot type in (:3300,
190
+ * 2026-10-19, the fan's blade-2). Its tool says it is placed by something else, as before.
191
+ */
192
+ private sizeDragTurned;
186
193
  /** Whether a size drag on this part could not show what is written: figure-model gives no face it keeps. */
187
194
  private sizeDragUnsure;
188
195
  /**
@@ -221,7 +221,7 @@ let FigureEditor = class FigureEditor extends LitElement {
221
221
  aria-pressed=${String(this.gizmoMode === tool.mode)}
222
222
  ?disabled=${!tool.can}
223
223
  aria-label=${i18next.t('figure.button.gizmo-' + tool.mode)}
224
- title=${`${i18next.t('figure.button.gizmo-' + tool.mode)} (${tool.key})${tool.can || !this.selected ? '' : ' · ' + (tool.mode === 'scale' && this.sizeDragUnsure(this.asset(), this.selected) ? this.sizeDragRefusalOf(this.selected) : i18next.t('figure.text.gizmo-not-own'))}`}
224
+ title=${`${i18next.t('figure.button.gizmo-' + tool.mode)} (${tool.key})${tool.can || !this.selected ? '' : ' · ' + (tool.mode === 'scale' && this.sizeDragTurned(this.asset(), this.selected) ? this.sizeDragRefusalOf(this.selected) : i18next.t('figure.text.gizmo-not-own'))}`}
225
225
  @click=${() => this.useGizmo(tool.mode)}
226
226
  >
227
227
  <md-icon>${tool.icon}</md-icon>
@@ -294,12 +294,18 @@ let FigureEditor = class FigureEditor extends LitElement {
294
294
  }
295
295
  /** The scene toggles: the mode already shown takes the gizmo away. */
296
296
  useGizmo(mode) {
297
- if (mode === 'scale' && this.selected && this.gizmoMode !== 'scale') {
297
+ /*
298
+ R does what the bar's resize tool does: on a part whose size is not its own to drag the tool is off, so no gizmo is
299
+ put on it to drag in vain (:3300, 10.1.196) -- the tool's own words are said instead, and a part turned is sent to
300
+ its size fields.
301
+ */
302
+ if (mode === 'scale' && this.selected && this.gizmoMode !== 'scale' && !this.reachOf(this.selected).scale) {
298
303
  const asset = this.asset();
299
- if (asset && this.sizeDragUnsure(asset, this.selected)) {
304
+ if (asset && this.sizeDragTurned(asset, this.selected))
300
305
  this.tellSizeByFields(this.selected);
301
- return;
302
- }
306
+ else
307
+ this.refusals.say(i18next.t('figure.text.gizmo-not-own'));
308
+ return;
303
309
  }
304
310
  this.renderRoot.querySelector('figure-canvas')?.gizmo(mode);
305
311
  this.gizmoMode = this.gizmoMode === mode ? undefined : mode;
@@ -568,6 +574,20 @@ let FigureEditor = class FigureEditor extends LitElement {
568
574
  return none;
569
575
  }
570
576
  }
577
+ /**
578
+ * Whether this part's size is its own to drag but the drag is withheld because it is turned: then the size fields are
579
+ * the way, and the notice says so. A part whose size is worked out from another part or from the figure's size is not
580
+ * its own to drag at all; it is not told it is attached turned, nor sent to fields it cannot type in (:3300,
581
+ * 2026-10-19, the fan's blade-2). Its tool says it is placed by something else, as before.
582
+ */
583
+ sizeDragTurned(asset, id) {
584
+ try {
585
+ return gizmoReachOf(asset, id).scale && this.sizeDragUnsure(asset, id);
586
+ }
587
+ catch {
588
+ return false;
589
+ }
590
+ }
571
591
  /** Whether a size drag on this part could not show what is written: figure-model gives no face it keeps. */
572
592
  sizeDragUnsure(asset, id) {
573
593
  try {
@@ -626,7 +646,7 @@ let FigureEditor = class FigureEditor extends LitElement {
626
646
  */
627
647
  const jointed = !!asset.joints?.some(j => j.body1.part === ownerOf(id));
628
648
  /* A size drag this part cannot show truly is not written: it springs back, and the reason is said. */
629
- if (result.scale && result.scale.some(k => Math.abs(k - 1) > 1e-4) && this.sizeDragUnsure(asset, id)) {
649
+ if (result.scale && result.scale.some(k => Math.abs(k - 1) > 1e-4) && this.sizeDragTurned(asset, id)) {
630
650
  this.tellSizeByFields(id);
631
651
  return this.requestUpdate();
632
652
  }