@things-factory/figure-ui 10.1.210 → 10.1.211
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.
- package/client/modeller/editor.ts +24 -32
- package/client/modeller/figure-links.ts +61 -37
- package/client/modeller/figure-size-editor.ts +41 -4
- package/client/modeller/links.ts +61 -22
- package/client/modeller/live.ts +33 -0
- package/dist-client/modeller/editor.d.ts +5 -0
- package/dist-client/modeller/editor.js +24 -32
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/modeller/figure-links.d.ts +2 -0
- package/dist-client/modeller/figure-links.js +66 -39
- package/dist-client/modeller/figure-links.js.map +1 -1
- package/dist-client/modeller/figure-size-editor.d.ts +3 -1
- package/dist-client/modeller/figure-size-editor.js +45 -4
- package/dist-client/modeller/figure-size-editor.js.map +1 -1
- package/dist-client/modeller/links.d.ts +14 -5
- package/dist-client/modeller/links.js +61 -23
- package/dist-client/modeller/links.js.map +1 -1
- package/dist-client/modeller/live.d.ts +14 -0
- package/dist-client/modeller/live.js +31 -0
- package/dist-client/modeller/live.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/browser/editing.check.mjs +38 -0
- package/test/browser/modeller.check.mjs +55 -0
- package/test/links.test.ts +39 -0
- package/translations/en.json +3 -0
- package/translations/es.json +3 -0
- package/translations/ja.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
|
@@ -55,7 +55,7 @@ import { canFollow, followableAxes, endPlaceKeyOf, followOf, sizeFollowersOf, me
|
|
|
55
55
|
import { jointFanOf } from './joint-fan.js';
|
|
56
56
|
import { derivedOf } from './revision.js';
|
|
57
57
|
import { jointDragOf } from './joint-drag.js';
|
|
58
|
-
import { liveOverSession, NOTHING_LIVE,
|
|
58
|
+
import { liveOverSession, NOTHING_LIVE, scrubLabel } from './live.js';
|
|
59
59
|
import { startingShapeKindOfBody } from './starting-shape.js';
|
|
60
60
|
import { GroupMenuStyles } from './group-menu.js';
|
|
61
61
|
/** The person's own fold of the properties' 「더 보기」, kept in their browser. */
|
|
@@ -832,7 +832,9 @@ let FigureEditor = class FigureEditor extends LitElement {
|
|
|
832
832
|
?locked=${unavailable}
|
|
833
833
|
@command=${(e) => this.linkCommand(e.detail.action)}
|
|
834
834
|
@size-recipe=${(e) => this.applySizeSteps(e.detail.steps)}
|
|
835
|
-
@size-input=${(e) => this.
|
|
835
|
+
@size-input=${(e) => this.writeField({ id: e.detail.input, unit: 'mm' }, e.detail.value)}
|
|
836
|
+
@size-typing=${(e) => this.hold(this.heldOf({ id: e.detail.input, unit: 'mm' }, e.detail.value))}
|
|
837
|
+
@size-let-go=${() => (this.live = NOTHING_LIVE)}
|
|
836
838
|
@fasten-open=${() => this.openFastening()}
|
|
837
839
|
.previewWords=${this.commandPreview.words()}
|
|
838
840
|
.detachWords=${this.commandPreview.detachWords(shown)}
|
|
@@ -1034,8 +1036,15 @@ let FigureEditor = class FigureEditor extends LitElement {
|
|
|
1034
1036
|
}
|
|
1035
1037
|
}
|
|
1036
1038
|
changeField(field, event) {
|
|
1037
|
-
const input = event.target
|
|
1038
|
-
|
|
1039
|
+
const input = event.target;
|
|
1040
|
+
// Rejected edits must also restore the displayed numeric value.
|
|
1041
|
+
input.value = String(this.writeField(field, input.valueAsNumber));
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* A number written to an input, from a field, a scrub or the size editor's rows: a size keeps the part's middle, or its
|
|
1045
|
+
* fastening -- figure-model's one size function (ADR-0140 4.1). Gives the value the input holds after, refused or not.
|
|
1046
|
+
*/
|
|
1047
|
+
writeField(field, value) {
|
|
1039
1048
|
const part = this.selected;
|
|
1040
1049
|
const change = { kind: field.role === 'state' ? 'set-state' : 'set-design', input: field.id, unit: field.unit, value };
|
|
1041
1050
|
const asset = this.shown()?.asset;
|
|
@@ -1045,8 +1054,7 @@ let FigureEditor = class FigureEditor extends LitElement {
|
|
|
1045
1054
|
const after = asset && part && field.role !== 'state' ? throughPlaneOf(this.shown().asset, drawableFigureParts(this.session.read().geometry ?? []), part) : 0;
|
|
1046
1055
|
if (after > before + 0.5)
|
|
1047
1056
|
this.tellThroughPlane(part, after);
|
|
1048
|
-
|
|
1049
|
-
input.value = String(this.session.read().fields.find(i => i.id === field.id).value);
|
|
1057
|
+
return this.session.read().fields.find(i => i.id === field.id).value;
|
|
1050
1058
|
}
|
|
1051
1059
|
/** Typing or a held spinner: each number on the way is drawn; the field's change records it. */
|
|
1052
1060
|
typing(field, event) {
|
|
@@ -1077,16 +1085,12 @@ let FigureEditor = class FigureEditor extends LitElement {
|
|
|
1077
1085
|
* pointer, and the release records one step. The field's number follows too, so the value in hand is always read.
|
|
1078
1086
|
*/
|
|
1079
1087
|
scrub(field, down, unavailable) {
|
|
1080
|
-
if (unavailable
|
|
1088
|
+
if (unavailable)
|
|
1081
1089
|
return;
|
|
1082
1090
|
const label = down.currentTarget;
|
|
1083
1091
|
const input = (label.closest('div[cell]')?.querySelector('input') ?? label.nextElementSibling);
|
|
1084
1092
|
if (!input)
|
|
1085
1093
|
return;
|
|
1086
|
-
down.preventDefault();
|
|
1087
|
-
label.setPointerCapture(down.pointerId);
|
|
1088
|
-
const start = field.value;
|
|
1089
|
-
let value = start;
|
|
1090
1094
|
/* Prepared once for the scrub: each move is a size through the same function its release writes with. */
|
|
1091
1095
|
const asset = this.shown()?.asset;
|
|
1092
1096
|
const sized = asset && this.selected && field.role !== 'state' ? (() => { try {
|
|
@@ -1095,29 +1099,17 @@ let FigureEditor = class FigureEditor extends LitElement {
|
|
|
1095
1099
|
catch {
|
|
1096
1100
|
return undefined;
|
|
1097
1101
|
} })() : undefined;
|
|
1098
|
-
|
|
1099
|
-
value
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
label.removeEventListener('pointercancel', up);
|
|
1107
|
-
/* A drag the system took away is not the author's value: the field goes back to where it was. */
|
|
1108
|
-
if (e.type === 'pointercancel')
|
|
1109
|
-
value = start;
|
|
1110
|
-
if (value === start) {
|
|
1111
|
-
input.value = String(start);
|
|
1102
|
+
scrubLabel(down, field, {
|
|
1103
|
+
move: value => {
|
|
1104
|
+
input.value = String(value);
|
|
1105
|
+
this.hold(this.heldOf(field, value, sized));
|
|
1106
|
+
},
|
|
1107
|
+
release: value => (input.value = String(this.writeField(field, value))),
|
|
1108
|
+
cancel: () => {
|
|
1109
|
+
input.value = String(field.value);
|
|
1112
1110
|
this.live = NOTHING_LIVE;
|
|
1113
|
-
return;
|
|
1114
1111
|
}
|
|
1115
|
-
|
|
1116
|
-
this.changeField(field, { target: input });
|
|
1117
|
-
};
|
|
1118
|
-
label.addEventListener('pointermove', move);
|
|
1119
|
-
label.addEventListener('pointerup', up);
|
|
1120
|
-
label.addEventListener('pointercancel', up);
|
|
1112
|
+
});
|
|
1121
1113
|
}
|
|
1122
1114
|
/** The sizes a board may give the figure: the ends the author typed, and the rest as far as its parts allow. */
|
|
1123
1115
|
renderInstanceRange(shown, unavailable) {
|