@lvl99dotcom/paintcanvas 0.2.0 → 0.3.0
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/README.md +2 -2
- package/dist/lib/i18n/index.d.ts +50 -13
- package/dist/lib/i18n/index.js +121 -26
- package/dist/locales/en-GB.js +177 -184
- package/dist/locales/en-US.js +177 -184
- package/dist/locales/fr.js +177 -184
- package/dist/locales/ja.js +177 -184
- package/dist/locales/ko.js +177 -184
- package/dist/locales/zh-Hans.js +177 -184
- package/dist/locales/zh-Hant.js +177 -184
- package/dist/package.js +1 -1
- package/dist/ui/base/index.d.ts +1 -1
- package/dist/ui/base/index.js +1 -1
- package/dist/ui/elements/PaintCanvas/index.js +11 -11
- package/dist/ui/elements/PcBrushConfig/index.d.ts +3 -3
- package/dist/ui/elements/PcBrushConfig/index.js +43 -41
- package/dist/ui/elements/PcBrushMenu/index.js +18 -18
- package/dist/ui/elements/PcBrushTest/index.js +2 -2
- package/dist/ui/elements/PcCanvas/index.js +1 -1
- package/dist/ui/elements/PcCanvasMap/index.js +1 -1
- package/dist/ui/elements/PcInfoTip/index.js +1 -1
- package/dist/ui/elements/PcInputSettings/index.js +17 -13
- package/dist/ui/elements/PcLayerItem/index.js +34 -34
- package/dist/ui/elements/PcLayersMenu/index.js +1 -1
- package/dist/ui/elements/PcStats/index.js +8 -5
- package/dist/ui/elements/PcThemePicker/index.js +2 -2
- package/dist/ui/elements/PcToast/index.js +1 -1
- package/dist/ui/elements/PcToolSettings/index.js +51 -45
- package/dist/ui/elements/PcToolbar/index.js +19 -19
- package/locales/en-GB.json +177 -184
- package/locales/en-US.json +177 -184
- package/locales/fr.json +177 -184
- package/locales/ja.json +177 -184
- package/locales/ko.json +177 -184
- package/locales/zh-Hans.json +177 -184
- package/locales/zh-Hant.json +177 -184
- package/package.json +1 -1
|
@@ -13,17 +13,17 @@ import { styleMap } from "lit/directives/style-map.js";
|
|
|
13
13
|
var SMOOTHING_CHOICES = [
|
|
14
14
|
{
|
|
15
15
|
value: SmoothingType.Linear,
|
|
16
|
-
label: "brushConfig.smoothingLinear",
|
|
16
|
+
label: "paintCanvas.brushConfig.smoothingLinear",
|
|
17
17
|
icon: "smoothingLinear"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
value: SmoothingType.BezierQuad,
|
|
21
|
-
label: "brushConfig.smoothingQuadratic",
|
|
21
|
+
label: "paintCanvas.brushConfig.smoothingQuadratic",
|
|
22
22
|
icon: "smoothingBezierQuad"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
value: SmoothingType.BezierCubic,
|
|
26
|
-
label: "brushConfig.smoothingCubic",
|
|
26
|
+
label: "paintCanvas.brushConfig.smoothingCubic",
|
|
27
27
|
icon: "smoothingBezierCubic"
|
|
28
28
|
}
|
|
29
29
|
];
|
|
@@ -35,16 +35,16 @@ var SOURCE_ICONS = {
|
|
|
35
35
|
};
|
|
36
36
|
/** Translation keys of the variation sources' names */
|
|
37
37
|
var SOURCE_LABELS = {
|
|
38
|
-
pressure: "toolSettings.pressure",
|
|
39
|
-
tilt: "toolSettings.tilt",
|
|
40
|
-
randomise: "brushConfig.randomise"
|
|
38
|
+
pressure: "paintCanvas.toolSettings.pressure",
|
|
39
|
+
tilt: "paintCanvas.toolSettings.tilt",
|
|
40
|
+
randomise: "paintCanvas.brushConfig.randomise"
|
|
41
41
|
};
|
|
42
42
|
/** Translation keys of the brush shape error messages */
|
|
43
43
|
var SHAPE_ERROR_KEYS = {
|
|
44
|
-
[SHAPE_ERRORS.type]: "shape.notPng",
|
|
45
|
-
[SHAPE_ERRORS.size]: "shape.tooLarge",
|
|
46
|
-
[SHAPE_ERRORS.decode]: "shape.readFailed",
|
|
47
|
-
[SHAPE_ERRORS.noImage]: "shape.noPngToPaste"
|
|
44
|
+
[SHAPE_ERRORS.type]: "paintCanvas.shape.notPng",
|
|
45
|
+
[SHAPE_ERRORS.size]: "paintCanvas.shape.tooLarge",
|
|
46
|
+
[SHAPE_ERRORS.decode]: "paintCanvas.shape.readFailed",
|
|
47
|
+
[SHAPE_ERRORS.noImage]: "paintCanvas.shape.noPngToPaste"
|
|
48
48
|
};
|
|
49
49
|
/** Largest stamp spacing in pixels */
|
|
50
50
|
var MAX_SPACING = 200;
|
|
@@ -169,7 +169,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
169
169
|
});
|
|
170
170
|
} catch (error) {
|
|
171
171
|
this.emit("pc-toast", {
|
|
172
|
-
message: this.t(error instanceof ShapeImageError && SHAPE_ERROR_KEYS[error.message] || "brushConfig.shapeFailed"),
|
|
172
|
+
message: this.t(error instanceof ShapeImageError && SHAPE_ERROR_KEYS[error.message] || "paintCanvas.brushConfig.shapeFailed"),
|
|
173
173
|
kind: "error"
|
|
174
174
|
});
|
|
175
175
|
}
|
|
@@ -182,10 +182,10 @@ var PcBrushConfig = class extends PcElement {
|
|
|
182
182
|
const app = this.app;
|
|
183
183
|
const draft = this.draft;
|
|
184
184
|
if (!app || !draft) return;
|
|
185
|
-
const name = this.prompt(this.t("brushConfig.presetName"), draft.name ?? "")?.trim();
|
|
185
|
+
const name = this.prompt(this.t("paintCanvas.brushConfig.presetName"), draft.name ?? "")?.trim();
|
|
186
186
|
if (!name) return;
|
|
187
187
|
const existing = app.customPresets.findOwn(name, app.authorHandle, app.names.unknownAuthor);
|
|
188
|
-
if (existing && !this.confirm(this.t("presets.replaceConfirm", { name }))) return;
|
|
188
|
+
if (existing && !this.confirm(this.t("paintCanvas.presets.replaceConfirm", { name }))) return;
|
|
189
189
|
const preset = {
|
|
190
190
|
...app.newPreset(draft, name),
|
|
191
191
|
...existing ? { id: existing.id } : {}
|
|
@@ -195,13 +195,13 @@ var PcBrushConfig = class extends PcElement {
|
|
|
195
195
|
await app.customPresets.save(preset);
|
|
196
196
|
(this.kind === "eraser" ? app.eraser : app.brush).select(preset.id);
|
|
197
197
|
this.emit("pc-toast", {
|
|
198
|
-
message: this.t("presets.saved", { name }),
|
|
198
|
+
message: this.t("paintCanvas.presets.saved", { name }),
|
|
199
199
|
kind: "success"
|
|
200
200
|
});
|
|
201
201
|
this.close();
|
|
202
202
|
} catch {
|
|
203
203
|
this.emit("pc-toast", {
|
|
204
|
-
message: this.t("presets.saveFailed", { name }),
|
|
204
|
+
message: this.t("paintCanvas.presets.saveFailed", { name }),
|
|
205
205
|
kind: "error"
|
|
206
206
|
});
|
|
207
207
|
} finally {
|
|
@@ -216,18 +216,18 @@ var PcBrushConfig = class extends PcElement {
|
|
|
216
216
|
const id = this.editingId;
|
|
217
217
|
if (!app || !id) return;
|
|
218
218
|
const name = app.customPresets.get(id)?.name ?? "this preset";
|
|
219
|
-
if (!this.confirm(this.t("presets.deleteConfirm", { name }))) return;
|
|
219
|
+
if (!this.confirm(this.t("paintCanvas.presets.deleteConfirm", { name }))) return;
|
|
220
220
|
this.busy = true;
|
|
221
221
|
try {
|
|
222
222
|
await app.customPresets.remove(id);
|
|
223
223
|
this.emit("pc-toast", {
|
|
224
|
-
message: this.t("presets.deleted", { name }),
|
|
224
|
+
message: this.t("paintCanvas.presets.deleted", { name }),
|
|
225
225
|
kind: "success"
|
|
226
226
|
});
|
|
227
227
|
this.close();
|
|
228
228
|
} catch {
|
|
229
229
|
this.emit("pc-toast", {
|
|
230
|
-
message: this.t("presets.deleteFailed", { name }),
|
|
230
|
+
message: this.t("paintCanvas.presets.deleteFailed", { name }),
|
|
231
231
|
kind: "error"
|
|
232
232
|
});
|
|
233
233
|
} finally {
|
|
@@ -282,7 +282,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
282
282
|
<input
|
|
283
283
|
type="checkbox"
|
|
284
284
|
class=${`${param} ${source}`}
|
|
285
|
-
aria-label=${this.t("brushConfig.variation", {
|
|
285
|
+
aria-label=${this.t("paintCanvas.brushConfig.variation", {
|
|
286
286
|
param: label,
|
|
287
287
|
source: this.t(SOURCE_LABELS[source])
|
|
288
288
|
})}
|
|
@@ -298,7 +298,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
298
298
|
renderShape(draft) {
|
|
299
299
|
const smoothing = draft.smoothingType === SmoothingType.None || draft.smoothingType === void 0 ? SmoothingType.Linear : draft.smoothingType;
|
|
300
300
|
return html`<div class="row shape-row">
|
|
301
|
-
<span class="label">${this.t("brushConfig.shape")}</span>
|
|
301
|
+
<span class="label">${this.t("paintCanvas.brushConfig.shape")}</span>
|
|
302
302
|
<span
|
|
303
303
|
class=${draft.image ? "shape-preview image" : "shape-preview"}
|
|
304
304
|
style=${styleMap({ maskImage: typeof draft.image === "string" ? `url("${draft.image}")` : void 0 })}
|
|
@@ -309,7 +309,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
309
309
|
?disabled=${this.busy}
|
|
310
310
|
@click=${() => this.renderRoot.querySelector("input.shape")?.click()}
|
|
311
311
|
>
|
|
312
|
-
${this.t("brushConfig.upload")}
|
|
312
|
+
${this.t("paintCanvas.brushConfig.upload")}
|
|
313
313
|
</button>
|
|
314
314
|
<!-- Chosen through "Upload" -->
|
|
315
315
|
<label class="visually-hidden">
|
|
@@ -331,14 +331,14 @@ var PcBrushConfig = class extends PcElement {
|
|
|
331
331
|
<button
|
|
332
332
|
type="button"
|
|
333
333
|
class="icon-button paste"
|
|
334
|
-
title=${this.t("brushConfig.paste")}
|
|
334
|
+
title=${this.t("paintCanvas.brushConfig.paste")}
|
|
335
335
|
?disabled=${this.busy}
|
|
336
336
|
@click=${() => void this.useShape(this.readClipboard)}
|
|
337
337
|
>
|
|
338
|
-
${iconLabel(this.iconUrl("clipboard"), this.t("brushConfig.paste"))}
|
|
338
|
+
${iconLabel(this.iconUrl("clipboard"), this.t("paintCanvas.brushConfig.paste"))}
|
|
339
339
|
</button>
|
|
340
340
|
<fieldset class="smoothing">
|
|
341
|
-
<legend>${this.t("brushConfig.smoothing")}</legend>
|
|
341
|
+
<legend>${this.t("paintCanvas.brushConfig.smoothing")}</legend>
|
|
342
342
|
${SMOOTHING_CHOICES.map((choice) => html`<label class="icon-toggle" title=${this.t(choice.label)}>
|
|
343
343
|
<input
|
|
344
344
|
type="radio"
|
|
@@ -368,11 +368,11 @@ var PcBrushConfig = class extends PcElement {
|
|
|
368
368
|
return html`<div
|
|
369
369
|
role="dialog"
|
|
370
370
|
aria-modal="true"
|
|
371
|
-
aria-label=${this.t(this.kind === "eraser" ? "brushConfig.eraserTitle" : "brushConfig.brushTitle")}
|
|
371
|
+
aria-label=${this.t(this.kind === "eraser" ? "paintCanvas.brushConfig.eraserTitle" : "paintCanvas.brushConfig.brushTitle")}
|
|
372
372
|
>
|
|
373
373
|
<div class="row header">
|
|
374
374
|
<label>
|
|
375
|
-
${this.t("brushConfig.name")}
|
|
375
|
+
${this.t("paintCanvas.brushConfig.name")}
|
|
376
376
|
<input
|
|
377
377
|
class="name"
|
|
378
378
|
.value=${draft.name ?? ""}
|
|
@@ -385,17 +385,17 @@ var PcBrushConfig = class extends PcElement {
|
|
|
385
385
|
class="close dismiss"
|
|
386
386
|
@click=${() => this.close()}
|
|
387
387
|
>
|
|
388
|
-
${this.t("common.dismiss")}
|
|
388
|
+
${this.t("paintCanvas.common.dismiss")}
|
|
389
389
|
</button>
|
|
390
390
|
</div>
|
|
391
391
|
<pc-brush-test .config=${draft} .tips=${this.app?.tips}></pc-brush-test>
|
|
392
392
|
${this.renderShape(draft)}
|
|
393
|
-
${this.renderParam(draft, "width", this.t("common.width"))}
|
|
393
|
+
${this.renderParam(draft, "width", this.t("paintCanvas.common.width"))}
|
|
394
394
|
<div class="row">
|
|
395
395
|
<span class="label"></span>
|
|
396
396
|
<label
|
|
397
397
|
class="icon-toggle"
|
|
398
|
-
title=${this.t("toolSettings.constrainProportions")}
|
|
398
|
+
title=${this.t("paintCanvas.toolSettings.constrainProportions")}
|
|
399
399
|
>
|
|
400
400
|
<input
|
|
401
401
|
type="checkbox"
|
|
@@ -404,19 +404,21 @@ var PcBrushConfig = class extends PcElement {
|
|
|
404
404
|
?disabled=${this.busy}
|
|
405
405
|
@change=${(e) => this.change({ constrainProportions: e.target.checked })}
|
|
406
406
|
/>
|
|
407
|
-
${iconLabel(this.iconUrl(constrained ? "linked" : "unlinked"), this.t("toolSettings.constrainProportions"))}
|
|
407
|
+
${iconLabel(this.iconUrl(constrained ? "linked" : "unlinked"), this.t("paintCanvas.toolSettings.constrainProportions"))}
|
|
408
408
|
</label>
|
|
409
409
|
</div>
|
|
410
|
-
${this.renderParam(draft, "height", this.t("common.height"), constrained)}
|
|
411
|
-
${this.renderParam(draft, "alpha", this.t("common.opacity"))}
|
|
412
|
-
${this.renderParam(draft, "rotation", this.t("brushConfig.rotation"))}
|
|
413
|
-
${this.renderParam(draft, "offsetX", this.t("brushConfig.offsetX"))}
|
|
414
|
-
${this.renderParam(draft, "offsetY", this.t("brushConfig.offsetY"))}
|
|
410
|
+
${this.renderParam(draft, "height", this.t("paintCanvas.common.height"), constrained)}
|
|
411
|
+
${this.renderParam(draft, "alpha", this.t("paintCanvas.common.opacity"))}
|
|
412
|
+
${this.renderParam(draft, "rotation", this.t("paintCanvas.brushConfig.rotation"))}
|
|
413
|
+
${this.renderParam(draft, "offsetX", this.t("paintCanvas.brushConfig.offsetX"))}
|
|
414
|
+
${this.renderParam(draft, "offsetY", this.t("paintCanvas.brushConfig.offsetY"))}
|
|
415
415
|
<div class="row">
|
|
416
|
-
<span class="label"
|
|
416
|
+
<span class="label"
|
|
417
|
+
>${this.t("paintCanvas.brushConfig.sampleRate")}</span
|
|
418
|
+
>
|
|
417
419
|
${this.number("sample-rate", draft.sampleRate ?? 5, sampleLimits, (sampleRate) => this.change({ sampleRate }))}
|
|
418
420
|
${this.slider("sample-rate", draft.sampleRate ?? 5, sampleLimits, (sampleRate) => this.change({ sampleRate }))}
|
|
419
|
-
<span class="label">${this.t("brushConfig.spacing")}</span>
|
|
421
|
+
<span class="label">${this.t("paintCanvas.brushConfig.spacing")}</span>
|
|
420
422
|
${this.number("spacing", draft.spacing ?? 5, spacingLimits, (spacing) => this.change({ spacing }))}
|
|
421
423
|
${this.slider("spacing", draft.spacing ?? 5, spacingLimits, (spacing) => this.change({ spacing }))}
|
|
422
424
|
</div>
|
|
@@ -428,7 +430,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
428
430
|
?disabled=${this.busy}
|
|
429
431
|
@change=${(e) => this.change({ snapToPixelGrid: e.target.checked })}
|
|
430
432
|
/>
|
|
431
|
-
${this.t("brushConfig.snapToPixelGrid")}
|
|
433
|
+
${this.t("paintCanvas.brushConfig.snapToPixelGrid")}
|
|
432
434
|
</label>
|
|
433
435
|
<div class="row">
|
|
434
436
|
${this.editingId ? html`<button
|
|
@@ -437,7 +439,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
437
439
|
?disabled=${this.busy}
|
|
438
440
|
@click=${() => void this.deletePreset()}
|
|
439
441
|
>
|
|
440
|
-
${this.t("brushConfig.deletePreset")}
|
|
442
|
+
${this.t("paintCanvas.brushConfig.deletePreset")}
|
|
441
443
|
</button>` : nothing}
|
|
442
444
|
<button
|
|
443
445
|
type="button"
|
|
@@ -445,7 +447,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
445
447
|
?disabled=${this.busy}
|
|
446
448
|
@click=${() => void this.addToPresets()}
|
|
447
449
|
>
|
|
448
|
-
${this.t("brushConfig.addToPresets")}
|
|
450
|
+
${this.t("paintCanvas.brushConfig.addToPresets")}
|
|
449
451
|
</button>
|
|
450
452
|
<button
|
|
451
453
|
type="button"
|
|
@@ -453,7 +455,7 @@ var PcBrushConfig = class extends PcElement {
|
|
|
453
455
|
?disabled=${this.busy}
|
|
454
456
|
@click=${() => this.save()}
|
|
455
457
|
>
|
|
456
|
-
${this.t("common.save")}
|
|
458
|
+
${this.t("paintCanvas.common.save")}
|
|
457
459
|
</button>
|
|
458
460
|
</div>
|
|
459
461
|
</div>`;
|
|
@@ -12,10 +12,10 @@ import { styleMap } from "lit/directives/style-map.js";
|
|
|
12
12
|
// src/ui/elements/PcBrushMenu/index.ts
|
|
13
13
|
/** Translation keys of the preset file error messages */
|
|
14
14
|
var PRESET_FILE_ERROR_KEYS = {
|
|
15
|
-
[PRESET_FILE_ERRORS.incompatible]: "presets.fileIncompatible",
|
|
16
|
-
[PRESET_FILE_ERRORS.read]: "presets.fileReadFailed",
|
|
17
|
-
[PRESET_FILE_ERRORS.export]: "presets.exportFailed",
|
|
18
|
-
[PRESET_FILE_ERRORS.empty]: "presets.nothingToExport"
|
|
15
|
+
[PRESET_FILE_ERRORS.incompatible]: "paintCanvas.presets.fileIncompatible",
|
|
16
|
+
[PRESET_FILE_ERRORS.read]: "paintCanvas.presets.fileReadFailed",
|
|
17
|
+
[PRESET_FILE_ERRORS.export]: "paintCanvas.presets.exportFailed",
|
|
18
|
+
[PRESET_FILE_ERRORS.empty]: "paintCanvas.presets.nothingToExport"
|
|
19
19
|
};
|
|
20
20
|
/** Cursor over a preset that a click deletes (Alt/Option held) */
|
|
21
21
|
var DELETE_CURSOR = svgCursor("M6 6 L18 18 M18 6 L6 18", [12, 12], "not-allowed");
|
|
@@ -129,16 +129,16 @@ var PcBrushMenu = class extends PcElement {
|
|
|
129
129
|
const app = this.app;
|
|
130
130
|
if (!app) return;
|
|
131
131
|
const name = preset.name ?? preset.id;
|
|
132
|
-
if (!this.confirm(this.t("presets.deleteConfirm", { name }))) return;
|
|
132
|
+
if (!this.confirm(this.t("paintCanvas.presets.deleteConfirm", { name }))) return;
|
|
133
133
|
try {
|
|
134
134
|
await app.customPresets.remove(preset.id);
|
|
135
135
|
this.emit("pc-toast", {
|
|
136
|
-
message: this.t("presets.deleted", { name }),
|
|
136
|
+
message: this.t("paintCanvas.presets.deleted", { name }),
|
|
137
137
|
kind: "success"
|
|
138
138
|
});
|
|
139
139
|
} catch {
|
|
140
140
|
this.emit("pc-toast", {
|
|
141
|
-
message: this.t("presets.deleteFailed", { name }),
|
|
141
|
+
message: this.t("paintCanvas.presets.deleteFailed", { name }),
|
|
142
142
|
kind: "error"
|
|
143
143
|
});
|
|
144
144
|
}
|
|
@@ -163,7 +163,7 @@ var PcBrushMenu = class extends PcElement {
|
|
|
163
163
|
const presets = parsePresetFile(text, [app.names.presetFileFormat, BRUSH_PRESET_FILE_FORMAT]);
|
|
164
164
|
await app.customPresets.save(...presets);
|
|
165
165
|
this.emit("pc-toast", {
|
|
166
|
-
message: this.t("presets.imported", { count: presets.length }),
|
|
166
|
+
message: this.t("paintCanvas.presets.imported", { count: presets.length }),
|
|
167
167
|
kind: "success"
|
|
168
168
|
});
|
|
169
169
|
} catch (error) {
|
|
@@ -201,8 +201,8 @@ var PcBrushMenu = class extends PcElement {
|
|
|
201
201
|
* A preset group's heading in the chosen language ("My presets" and "Unknown" are translated; author names aren't).
|
|
202
202
|
*/
|
|
203
203
|
groupLabel(label) {
|
|
204
|
-
if (label === "My presets") return this.t("presets.myPresets");
|
|
205
|
-
if (label === "Unknown") return this.t("presets.unknownAuthor");
|
|
204
|
+
if (label === "My presets") return this.t("paintCanvas.presets.myPresets");
|
|
205
|
+
if (label === "Unknown") return this.t("paintCanvas.presets.unknownAuthor");
|
|
206
206
|
return label;
|
|
207
207
|
}
|
|
208
208
|
/** The brush or eraser settings this menu controls */
|
|
@@ -273,7 +273,7 @@ var PcBrushMenu = class extends PcElement {
|
|
|
273
273
|
render() {
|
|
274
274
|
const settings = this.settings;
|
|
275
275
|
if (!settings) return html``;
|
|
276
|
-
const title = this.t(this.kind === "eraser" ? "tool.eraser" : "tool.brush");
|
|
276
|
+
const title = this.t(this.kind === "eraser" ? "paintCanvas.tool.eraser" : "paintCanvas.tool.brush");
|
|
277
277
|
const presets = Object.values(settings.presets);
|
|
278
278
|
const sizes = previewSizes(presets);
|
|
279
279
|
const app = this.app;
|
|
@@ -294,9 +294,9 @@ var PcBrushMenu = class extends PcElement {
|
|
|
294
294
|
<div
|
|
295
295
|
class="size"
|
|
296
296
|
role="slider"
|
|
297
|
-
aria-label=${this.t("brushMenu.size", { tool: title })}
|
|
297
|
+
aria-label=${this.t("paintCanvas.brushMenu.size", { tool: title })}
|
|
298
298
|
aria-valuenow=${settings.width}
|
|
299
|
-
title=${this.t("brushMenu.dragToResize")}
|
|
299
|
+
title=${this.t("paintCanvas.brushMenu.dragToResize")}
|
|
300
300
|
@pointerdown=${this.onPointerDown}
|
|
301
301
|
@pointermove=${this.onPointerMove}
|
|
302
302
|
@pointerup=${this.onPointerUp}
|
|
@@ -307,7 +307,7 @@ var PcBrushMenu = class extends PcElement {
|
|
|
307
307
|
</div>
|
|
308
308
|
<div
|
|
309
309
|
class="presets"
|
|
310
|
-
aria-label=${this.t("brushMenu.presets", { tool: title })}
|
|
310
|
+
aria-label=${this.t("paintCanvas.brushMenu.presets", { tool: title })}
|
|
311
311
|
>
|
|
312
312
|
${groups.map((group) => html`
|
|
313
313
|
<h3>${this.groupLabel(group.label)}</h3>
|
|
@@ -322,18 +322,18 @@ var PcBrushMenu = class extends PcElement {
|
|
|
322
322
|
class="pill new-preset"
|
|
323
323
|
@click=${() => this.emit("pc-new-preset", this.kind)}
|
|
324
324
|
>
|
|
325
|
-
${this.t("brushMenu.create")}
|
|
325
|
+
${this.t("paintCanvas.brushMenu.create")}
|
|
326
326
|
</button>
|
|
327
327
|
<button
|
|
328
328
|
type="button"
|
|
329
329
|
class="pill import"
|
|
330
330
|
@click=${() => this.renderRoot.querySelector(".import-file")?.click()}
|
|
331
331
|
>
|
|
332
|
-
${this.t("brushMenu.import")}
|
|
332
|
+
${this.t("paintCanvas.brushMenu.import")}
|
|
333
333
|
</button>
|
|
334
334
|
<!-- Chosen through "Import" -->
|
|
335
335
|
<label class="visually-hidden">
|
|
336
|
-
${this.t("brushMenu.importFile")}
|
|
336
|
+
${this.t("paintCanvas.brushMenu.importFile")}
|
|
337
337
|
<input
|
|
338
338
|
type="file"
|
|
339
339
|
class="import-file"
|
|
@@ -352,7 +352,7 @@ var PcBrushMenu = class extends PcElement {
|
|
|
352
352
|
class="pill export"
|
|
353
353
|
@click=${() => void this.exportFile()}
|
|
354
354
|
>
|
|
355
|
-
${this.t("brushMenu.export")}
|
|
355
|
+
${this.t("paintCanvas.brushMenu.export")}
|
|
356
356
|
</button>
|
|
357
357
|
</div>
|
|
358
358
|
`;
|
|
@@ -120,14 +120,14 @@ var PcBrushTest = class extends PcElement {
|
|
|
120
120
|
<canvas
|
|
121
121
|
width=${800}
|
|
122
122
|
height=${320}
|
|
123
|
-
aria-label=${this.t("brushConfig.testArea")}
|
|
123
|
+
aria-label=${this.t("paintCanvas.brushConfig.testArea")}
|
|
124
124
|
@pointerdown=${this.onPointerDown}
|
|
125
125
|
@pointermove=${this.onPointerMove}
|
|
126
126
|
@pointerup=${this.onPointerUp}
|
|
127
127
|
@pointercancel=${this.onPointerUp}
|
|
128
128
|
></canvas>
|
|
129
129
|
<button type="button" class="clear" @click=${() => this.clear()}>
|
|
130
|
-
${this.t("common.clear")}
|
|
130
|
+
${this.t("paintCanvas.common.clear")}
|
|
131
131
|
</button>
|
|
132
132
|
`;
|
|
133
133
|
}
|
|
@@ -981,7 +981,7 @@ var PcCanvas = class extends PcElement {
|
|
|
981
981
|
render() {
|
|
982
982
|
return html`<canvas
|
|
983
983
|
class="scene"
|
|
984
|
-
aria-label=${this.t("canvas.label")}
|
|
984
|
+
aria-label=${this.t("paintCanvas.canvas.label")}
|
|
985
985
|
@pointerdown=${this.onPointerDown}
|
|
986
986
|
@pointermove=${this.onPointerMove}
|
|
987
987
|
@pointerup=${this.onPointerUp}
|
|
@@ -165,7 +165,7 @@ var PcCanvasMap = class extends PcElement {
|
|
|
165
165
|
};
|
|
166
166
|
return html`
|
|
167
167
|
<canvas
|
|
168
|
-
aria-label=${this.t("canvas.map")}
|
|
168
|
+
aria-label=${this.t("paintCanvas.canvas.map")}
|
|
169
169
|
@pointerdown=${this.onPointerDown}
|
|
170
170
|
@pointermove=${this.onPointerMove}
|
|
171
171
|
@pointerup=${() => this.dragging = false}
|
|
@@ -79,7 +79,7 @@ var PcInfoTip = class extends PcElement {
|
|
|
79
79
|
return html`<button
|
|
80
80
|
part="button"
|
|
81
81
|
type="button"
|
|
82
|
-
aria-label=${this.label || this.t("common.moreInformation")}
|
|
82
|
+
aria-label=${this.label || this.t("paintCanvas.common.moreInformation")}
|
|
83
83
|
aria-expanded=${String(this.open)}
|
|
84
84
|
aria-describedby=${this.open ? "tip" : nothing}
|
|
85
85
|
@click=${() => this.open = !this.open}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { PcElement, defineElement, emit } from "../../base/index.js";
|
|
2
2
|
import ChangeController from "../../ChangeController/index.js";
|
|
3
|
+
import { languageName } from "../../../lib/i18n/index.js";
|
|
3
4
|
import { isTouchDevice, zoomModifierName } from "../../../lib/classes/InputSettings/index.js";
|
|
4
5
|
import { GESTURE_ACTIONS, TOUCH_GESTURES, assignGesture } from "../../../lib/utils/gestures/index.js";
|
|
5
6
|
import { css, html, nothing } from "lit";
|
|
6
7
|
// src/ui/elements/PcInputSettings/index.ts
|
|
7
8
|
/** Translation keys of the gesture actions' names */
|
|
8
9
|
var ACTION_KEYS = {
|
|
9
|
-
undo: "common.undo",
|
|
10
|
-
redo: "common.redo",
|
|
11
|
-
copy: "common.copy",
|
|
12
|
-
paste: "common.paste"
|
|
10
|
+
undo: "paintCanvas.common.undo",
|
|
11
|
+
redo: "paintCanvas.common.redo",
|
|
12
|
+
copy: "paintCanvas.common.copy",
|
|
13
|
+
paste: "paintCanvas.common.paste"
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* How the user's input devices control the canvas: scrolling and pinching (with Cmd/Ctrl + scroll to zoom on devices
|
|
@@ -92,7 +93,7 @@ var PcInputSettings = class extends PcElement {
|
|
|
92
93
|
*/
|
|
93
94
|
renderGestures(data) {
|
|
94
95
|
return html`<fieldset part="gestures">
|
|
95
|
-
<legend>${this.t("inputSettings.gestures")}</legend>
|
|
96
|
+
<legend>${this.t("paintCanvas.inputSettings.gestures")}</legend>
|
|
96
97
|
${GESTURE_ACTIONS.map((action) => html`<label for="gesture-${action}"
|
|
97
98
|
>${this.t(ACTION_KEYS[action])}</label
|
|
98
99
|
>
|
|
@@ -105,7 +106,7 @@ var PcInputSettings = class extends PcElement {
|
|
|
105
106
|
value=${gesture}
|
|
106
107
|
?selected=${data.gestures[action] === gesture}
|
|
107
108
|
>
|
|
108
|
-
${this.t(gesture === "off" ? "common.off" : `gesture.${gesture}`)}
|
|
109
|
+
${this.t(gesture === "off" ? "paintCanvas.common.off" : `paintCanvas.gesture.${gesture}`)}
|
|
109
110
|
</option>`)}
|
|
110
111
|
</select>`)}
|
|
111
112
|
</fieldset>`;
|
|
@@ -114,7 +115,9 @@ var PcInputSettings = class extends PcElement {
|
|
|
114
115
|
renderLanguage() {
|
|
115
116
|
const translations = this.translations;
|
|
116
117
|
return html`<fieldset part="language">
|
|
117
|
-
<label for="language"
|
|
118
|
+
<label for="language"
|
|
119
|
+
>${this.t("paintCanvas.inputSettings.language")}</label
|
|
120
|
+
>
|
|
118
121
|
<select
|
|
119
122
|
id="language"
|
|
120
123
|
name="language"
|
|
@@ -125,9 +128,10 @@ var PcInputSettings = class extends PcElement {
|
|
|
125
128
|
>
|
|
126
129
|
${translations.locales.map((locale) => html`<option
|
|
127
130
|
value=${locale}
|
|
131
|
+
lang=${locale}
|
|
128
132
|
?selected=${translations.locale === locale}
|
|
129
133
|
>
|
|
130
|
-
${
|
|
134
|
+
${languageName(locale)}
|
|
131
135
|
</option>`)}
|
|
132
136
|
</select>
|
|
133
137
|
</fieldset>`;
|
|
@@ -136,11 +140,11 @@ var PcInputSettings = class extends PcElement {
|
|
|
136
140
|
const data = this.settings?.data;
|
|
137
141
|
if (!data) return nothing;
|
|
138
142
|
return html`<fieldset part="controls">
|
|
139
|
-
<legend>${this.t("inputSettings.title")}</legend>
|
|
140
|
-
${this.toggle(data, "scrollPan", this.t(this.touch ? "inputSettings.touchPan" : "inputSettings.scrollPan"))}
|
|
141
|
-
${this.toggle(data, "pinchZoom", this.t("inputSettings.pinchZoom"))}
|
|
142
|
-
${this.touch ? nothing : this.toggle(data, "modifierScrollZoom", this.t("inputSettings.modifierScrollZoom", { key: this.modifier }))}
|
|
143
|
-
${this.focusPen ? this.toggle(data, "focusPen", this.t("inputSettings.focusPen")) : nothing}
|
|
143
|
+
<legend>${this.t("paintCanvas.inputSettings.title")}</legend>
|
|
144
|
+
${this.toggle(data, "scrollPan", this.t(this.touch ? "paintCanvas.inputSettings.touchPan" : "paintCanvas.inputSettings.scrollPan"))}
|
|
145
|
+
${this.toggle(data, "pinchZoom", this.t("paintCanvas.inputSettings.pinchZoom"))}
|
|
146
|
+
${this.touch ? nothing : this.toggle(data, "modifierScrollZoom", this.t("paintCanvas.inputSettings.modifierScrollZoom", { key: this.modifier }))}
|
|
147
|
+
${this.focusPen ? this.toggle(data, "focusPen", this.t("paintCanvas.inputSettings.focusPen")) : nothing}
|
|
144
148
|
</fieldset>
|
|
145
149
|
${this.touch ? this.renderGestures(data) : nothing}
|
|
146
150
|
${this.languages ? this.renderLanguage() : nothing}`;
|