@m2c2kit/addons 0.3.9 → 0.3.11
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/dist/index.d.ts +175 -2
- package/dist/index.js +606 -191
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Canvas } from 'canvaskit-wasm';
|
|
2
|
-
import { CompositeOptions, Size, RgbaColor, Composite, Entity, GlobalVariables, TextOptions, IText, EntityEvent,
|
|
2
|
+
import { CompositeOptions, Size, RgbaColor, Composite, Entity, GlobalVariables, TextOptions, IText, EntityEvent, Point, CallbackOptions, ShapeOptions, LabelHorizontalAlignmentMode, Transition, StoryOptions, Story, Scene } from '@m2c2kit/core';
|
|
3
3
|
|
|
4
4
|
interface GridOptions extends CompositeOptions {
|
|
5
5
|
/** Number of rows in the grid. Must be 1 or greater */
|
|
@@ -206,6 +206,179 @@ declare class Dialog extends Composite {
|
|
|
206
206
|
warmup(canvas: Canvas): void;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
interface DrawPadOptions extends CompositeOptions {
|
|
210
|
+
/** Size of the DrawPad */
|
|
211
|
+
size: Size;
|
|
212
|
+
/** Color of drawn lines. Default is red. */
|
|
213
|
+
lineColor?: RgbaColor;
|
|
214
|
+
/** Width of drawn lines. Default is 1 */
|
|
215
|
+
lineWidth?: number;
|
|
216
|
+
/** Background color of the DrawPad. Default is transparent. */
|
|
217
|
+
backgroundColor?: RgbaColor;
|
|
218
|
+
/** Width of the border. Default is 1 */
|
|
219
|
+
borderWidth?: number;
|
|
220
|
+
/** Color of the border. Default is black */
|
|
221
|
+
borderColor?: RgbaColor;
|
|
222
|
+
/** Does the DrawPad respond to user interaction? Default is true. */
|
|
223
|
+
isUserInteractionEnabled?: boolean;
|
|
224
|
+
/** Should drawing resume when the pointer, in a down state, returns to the DrawPad area after exiting it while drawing? Default is false. */
|
|
225
|
+
resumeDrawingOnReturn?: boolean;
|
|
226
|
+
/** Should the user be permitted to draw only one continuous line? If so, no more drawing is allowed after the first stroke ends. */
|
|
227
|
+
continuousDrawingOnly?: boolean;
|
|
228
|
+
/** If `continuousDrawingOnly`, this is the maximum pixel distance from the last stroke's end point that the user is allowed to continue drawing with a new stroke. */
|
|
229
|
+
continuousDrawingOnlyExceptionDistance?: number;
|
|
230
|
+
}
|
|
231
|
+
declare const DrawPadEventType: {
|
|
232
|
+
readonly StrokeStart: "StrokeStart";
|
|
233
|
+
readonly StrokeMove: "StrokeMove";
|
|
234
|
+
readonly StrokeEnd: "StrokeEnd";
|
|
235
|
+
};
|
|
236
|
+
type DrawPadEventType = (typeof DrawPadEventType)[keyof typeof DrawPadEventType];
|
|
237
|
+
interface DrawPadEvent extends EntityEvent {
|
|
238
|
+
type: DrawPadEventType;
|
|
239
|
+
position: Point;
|
|
240
|
+
}
|
|
241
|
+
declare const DrawPadItemEventType: {
|
|
242
|
+
readonly StrokeEnter: "StrokeEnter";
|
|
243
|
+
readonly StrokeLeave: "StrokeLeave";
|
|
244
|
+
};
|
|
245
|
+
type DrawPadItemEventType = (typeof DrawPadItemEventType)[keyof typeof DrawPadItemEventType];
|
|
246
|
+
interface DrawPadItemEvent extends EntityEvent {
|
|
247
|
+
type: DrawPadItemEventType;
|
|
248
|
+
}
|
|
249
|
+
interface StrokeInteraction {
|
|
250
|
+
/** Type of user interaction with the stroke: StrokeStart, StrokeMove, or StrokeEnd. */
|
|
251
|
+
type: DrawPadEventType;
|
|
252
|
+
/** Position on the DrawPad where the interaction occurred. In the DrawPad coordinate system, (0, 0) is the upper-left corner. */
|
|
253
|
+
position: Point;
|
|
254
|
+
/** Device ISO8601 Timestamp of the interaction. */
|
|
255
|
+
iso8601Timestamp: string;
|
|
256
|
+
}
|
|
257
|
+
type DrawPadStroke = Array<StrokeInteraction>;
|
|
258
|
+
interface DrawPadItem {
|
|
259
|
+
/**
|
|
260
|
+
* Executes a callback when a DrawPad stroke begins on or enters the DrawPadItem.
|
|
261
|
+
*
|
|
262
|
+
* @param callback - function to execute
|
|
263
|
+
* @param options - {@link CallbackOptions}
|
|
264
|
+
*/
|
|
265
|
+
onStrokeEnter(callback: (ev: DrawPadItemEvent) => void, options?: CallbackOptions): void;
|
|
266
|
+
/**
|
|
267
|
+
* Executes a callback when a DrawPad stroke leaves the DrawPadItem.
|
|
268
|
+
*
|
|
269
|
+
* @param callback - function to execute
|
|
270
|
+
* @param options - {@link CallbackOptions}
|
|
271
|
+
*/
|
|
272
|
+
onStrokeLeave(callback: (ev: DrawPadItemEvent) => void, options?: CallbackOptions): void;
|
|
273
|
+
/** Is a DrawPad stroke currently within the bounds of the DrawPad item? */
|
|
274
|
+
isStrokeWithinBounds: boolean;
|
|
275
|
+
/** Position of the DrawPadItem within the DrawPad coordinate system, in which (0, 0) is the upper-left corner. */
|
|
276
|
+
drawPadPosition: Point;
|
|
277
|
+
}
|
|
278
|
+
declare class DrawPad extends Composite {
|
|
279
|
+
compositeType: string;
|
|
280
|
+
resumeDrawingOnReturn: boolean;
|
|
281
|
+
continuousDrawingOnly: boolean;
|
|
282
|
+
continuousDrawingOnlyExceptionDistance: number | undefined;
|
|
283
|
+
private _backgroundColor;
|
|
284
|
+
private _borderColor;
|
|
285
|
+
private _borderWidth;
|
|
286
|
+
private _lineColor;
|
|
287
|
+
private _lineWidth;
|
|
288
|
+
/** The rectangular "pad" on which to draw */
|
|
289
|
+
private drawArea?;
|
|
290
|
+
/** The lines that are drawn */
|
|
291
|
+
private drawShape?;
|
|
292
|
+
private isDrawingPointerDown;
|
|
293
|
+
private pointerIsDownAndPointerLeftDrawAreaWhenDown;
|
|
294
|
+
private currentStrokesNotAllowed;
|
|
295
|
+
/** Array of strokes created on the DrawPad, with position and timestamps
|
|
296
|
+
* of all interactions with each DrawPadStroke.
|
|
297
|
+
*/
|
|
298
|
+
strokes: DrawPadStroke[];
|
|
299
|
+
/**
|
|
300
|
+
* A rectangular area on which the user can draw strokes (lines).
|
|
301
|
+
*
|
|
302
|
+
* @remarks This composite entity is composed of a rectangle Shape and
|
|
303
|
+
* another Shape that is formed from a path of points.
|
|
304
|
+
*
|
|
305
|
+
* @param options - {@link DrawPadOptions}
|
|
306
|
+
*/
|
|
307
|
+
constructor(options: DrawPadOptions);
|
|
308
|
+
initialize(): void;
|
|
309
|
+
private initializeDrawShape;
|
|
310
|
+
private initializeDrawArea;
|
|
311
|
+
private dist;
|
|
312
|
+
private handleTapDown;
|
|
313
|
+
private handleTapLeave;
|
|
314
|
+
private handleTapUpAny;
|
|
315
|
+
private handlePointerMove;
|
|
316
|
+
update(): void;
|
|
317
|
+
draw(canvas: Canvas): void;
|
|
318
|
+
private raiseDrawPadEvent;
|
|
319
|
+
private raiseDrawPadItemEvent;
|
|
320
|
+
/**
|
|
321
|
+
* Removes all strokes from the DrawPad.
|
|
322
|
+
*/
|
|
323
|
+
clear(): void;
|
|
324
|
+
warmup(canvas: Canvas): void;
|
|
325
|
+
/**
|
|
326
|
+
* Executes a callback when the user starts a stroke on the DrawPad.
|
|
327
|
+
*
|
|
328
|
+
* @param callback - function to execute
|
|
329
|
+
* @param options - {@link CallbackOptions}
|
|
330
|
+
*/
|
|
331
|
+
onStrokeStart(callback: (ev: DrawPadEvent) => void, options?: CallbackOptions): void;
|
|
332
|
+
/**
|
|
333
|
+
* Executes a callback when the user moves a stroke on the DrawPad.
|
|
334
|
+
*
|
|
335
|
+
* @param callback - function to execute
|
|
336
|
+
* @param options - {@link CallbackOptions}
|
|
337
|
+
*/
|
|
338
|
+
onStrokeMove(callback: (ev: DrawPadEvent) => void, options?: CallbackOptions): void;
|
|
339
|
+
/**
|
|
340
|
+
* Executes a callback when the user ends a stroke on the DrawPad.
|
|
341
|
+
*
|
|
342
|
+
* @param callback - function to execute
|
|
343
|
+
* @param options - {@link CallbackOptions}
|
|
344
|
+
*/
|
|
345
|
+
onStrokeEnd(callback: (ev: DrawPadEvent) => void, options?: CallbackOptions): void;
|
|
346
|
+
/**
|
|
347
|
+
* Adds an entity to the DrawPad.
|
|
348
|
+
*
|
|
349
|
+
* @remarks After the entity is added to the DrawPad, its
|
|
350
|
+
* position is adjusted to be relative to the DrawPad's coordinate
|
|
351
|
+
* system, and it is made interactive. The method returns an object
|
|
352
|
+
* which is the entity as a DrawPadItem, which has additional methods,
|
|
353
|
+
* properties, and events specific to it now being on a DrawPad. The entity
|
|
354
|
+
* now **must** be manipulated only using the DrawPadItem object. Using
|
|
355
|
+
* the original entity object will result in undefined behavior.
|
|
356
|
+
*
|
|
357
|
+
* @param entity - the entity to add to the DrawPad
|
|
358
|
+
* @returns the entity as a DrawPadItem
|
|
359
|
+
*/
|
|
360
|
+
addItem<T extends Entity>(entity: T): T & DrawPadItem;
|
|
361
|
+
/**
|
|
362
|
+
* Takes a screenshot of the DrawPad.
|
|
363
|
+
*
|
|
364
|
+
* @returns a base64-encoded string of the DrawPad's current state in
|
|
365
|
+
* PNG format.
|
|
366
|
+
*/
|
|
367
|
+
takeScreenshot(): string;
|
|
368
|
+
private arrayBufferToBase64String;
|
|
369
|
+
get backgroundColor(): RgbaColor;
|
|
370
|
+
set backgroundColor(backgroundColor: RgbaColor);
|
|
371
|
+
get borderColor(): RgbaColor;
|
|
372
|
+
set borderColor(borderColor: RgbaColor);
|
|
373
|
+
get borderWidth(): number;
|
|
374
|
+
set borderWidth(borderWidth: number);
|
|
375
|
+
get lineColor(): RgbaColor;
|
|
376
|
+
set lineColor(lineColor: RgbaColor);
|
|
377
|
+
get lineWidth(): number;
|
|
378
|
+
set lineWidth(lineWidth: number);
|
|
379
|
+
duplicate(newName?: string): DrawPad;
|
|
380
|
+
}
|
|
381
|
+
|
|
209
382
|
interface KeyConfiguration {
|
|
210
383
|
/** Width of the key in units of a regular key width. Default is 1. */
|
|
211
384
|
widthRatio?: number;
|
|
@@ -430,4 +603,4 @@ declare class Instructions extends Story {
|
|
|
430
603
|
static Create(options: InstructionsOptions): Array<Scene>;
|
|
431
604
|
}
|
|
432
605
|
|
|
433
|
-
export { Button, ButtonOptions, Dialog, DialogEvent, DialogOptions, DialogResult, Grid, GridOptions, InstructionScene, Instructions, InstructionsOptions, KeyConfiguration, KeyTapMetadata, VirtualKeyboard, VirtualKeyboardEvent, VirtualKeyboardOptions, VirtualKeyboardRow };
|
|
606
|
+
export { Button, type ButtonOptions, Dialog, type DialogEvent, type DialogOptions, DialogResult, DrawPad, type DrawPadEvent, DrawPadEventType, type DrawPadItem, type DrawPadItemEvent, DrawPadItemEventType, type DrawPadOptions, type DrawPadStroke, Grid, type GridOptions, type InstructionScene, Instructions, type InstructionsOptions, type KeyConfiguration, type KeyTapMetadata, type StrokeInteraction, VirtualKeyboard, type VirtualKeyboardEvent, type VirtualKeyboardOptions, type VirtualKeyboardRow };
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
import { Composite, WebColors, Shape, Label, CanvasKitHelpers, EventType, Easings, Story, Transition, TransitionDirection, LabelHorizontalAlignmentMode, Scene, Dimensions, Sprite } from '@m2c2kit/core';
|
|
1
|
+
import { Composite, WebColors, Shape, Label, CanvasKitHelpers, EventType, MutablePath, Easings, Story, Transition, TransitionDirection, LabelHorizontalAlignmentMode, Scene, Dimensions, Sprite } from '@m2c2kit/core';
|
|
2
2
|
|
|
3
|
-
var __defProp$3 = Object.defineProperty;
|
|
4
|
-
var __defProps$1 = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues$1 = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
13
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols$1)
|
|
15
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
16
|
-
if (__propIsEnum$1.call(b, prop))
|
|
17
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
22
|
-
var __publicField$3 = (obj, key, value) => {
|
|
23
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
-
return value;
|
|
25
|
-
};
|
|
26
3
|
class Grid extends Composite {
|
|
27
4
|
/**
|
|
28
5
|
* A rectangular grid that supports placement of entities within the grid's
|
|
@@ -36,19 +13,16 @@ class Grid extends Composite {
|
|
|
36
13
|
*/
|
|
37
14
|
constructor(options) {
|
|
38
15
|
super(options);
|
|
39
|
-
|
|
16
|
+
this.compositeType = "grid";
|
|
40
17
|
// Grid options
|
|
41
18
|
// TODO: make getter, setter for these so they can be changed after initial construction
|
|
42
|
-
|
|
43
|
-
|
|
19
|
+
this.rows = 0;
|
|
20
|
+
this.columns = 0;
|
|
44
21
|
// default Grid is: transparent gray, red lines, line width 1
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
__publicField$3(this, "cellHeight");
|
|
50
|
-
__publicField$3(this, "gridChildren", new Array());
|
|
51
|
-
__publicField$3(this, "_gridBackground");
|
|
22
|
+
this.gridBackgroundColor = [0, 0, 233, 0.25];
|
|
23
|
+
this.gridLineColor = WebColors.Red;
|
|
24
|
+
this.gridLineWidth = 1;
|
|
25
|
+
this.gridChildren = new Array();
|
|
52
26
|
if (options.size) {
|
|
53
27
|
this.size = options.size;
|
|
54
28
|
} else {
|
|
@@ -162,7 +136,9 @@ class Grid extends Composite {
|
|
|
162
136
|
* provided, name will be the new uuid
|
|
163
137
|
*/
|
|
164
138
|
duplicate(newName) {
|
|
165
|
-
const dest = new Grid(
|
|
139
|
+
const dest = new Grid({
|
|
140
|
+
...this.getEntityOptions(),
|
|
141
|
+
...this.getDrawableOptions(),
|
|
166
142
|
rows: this.rows,
|
|
167
143
|
columns: this.columns,
|
|
168
144
|
size: this.size,
|
|
@@ -170,7 +146,7 @@ class Grid extends Composite {
|
|
|
170
146
|
gridLineWidth: this.gridLineWidth,
|
|
171
147
|
gridLineColor: this.gridLineColor,
|
|
172
148
|
name: newName
|
|
173
|
-
})
|
|
149
|
+
});
|
|
174
150
|
if (this.children.length > 0) {
|
|
175
151
|
dest.children = this.children.map((child) => {
|
|
176
152
|
const clonedChild = child.duplicate();
|
|
@@ -262,29 +238,6 @@ class Grid extends Composite {
|
|
|
262
238
|
}
|
|
263
239
|
}
|
|
264
240
|
|
|
265
|
-
var __defProp$2 = Object.defineProperty;
|
|
266
|
-
var __defProps = Object.defineProperties;
|
|
267
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
268
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
269
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
270
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
271
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
272
|
-
var __spreadValues = (a, b) => {
|
|
273
|
-
for (var prop in b || (b = {}))
|
|
274
|
-
if (__hasOwnProp.call(b, prop))
|
|
275
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
276
|
-
if (__getOwnPropSymbols)
|
|
277
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
278
|
-
if (__propIsEnum.call(b, prop))
|
|
279
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
280
|
-
}
|
|
281
|
-
return a;
|
|
282
|
-
};
|
|
283
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
284
|
-
var __publicField$2 = (obj, key, value) => {
|
|
285
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
286
|
-
return value;
|
|
287
|
-
};
|
|
288
241
|
class Button extends Composite {
|
|
289
242
|
// todo: add getters/setters so button can respond to changes in its options
|
|
290
243
|
// todo: add default "behaviors" (?) like button click animation?
|
|
@@ -299,15 +252,14 @@ class Button extends Composite {
|
|
|
299
252
|
*/
|
|
300
253
|
constructor(options) {
|
|
301
254
|
super(options);
|
|
302
|
-
|
|
255
|
+
this.compositeType = "button";
|
|
303
256
|
// Button options
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
__publicField$2(this, "backgroundPaint");
|
|
257
|
+
this._backgroundColor = WebColors.Black;
|
|
258
|
+
this.size = { width: 200, height: 50 };
|
|
259
|
+
this.cornerRadius = 9;
|
|
260
|
+
this.fontSize = 20;
|
|
261
|
+
this.text = "";
|
|
262
|
+
this._fontColor = WebColors.White;
|
|
311
263
|
if (options.text) {
|
|
312
264
|
this.text = options.text;
|
|
313
265
|
}
|
|
@@ -381,13 +333,16 @@ class Button extends Composite {
|
|
|
381
333
|
* provided, name will be the new uuid
|
|
382
334
|
*/
|
|
383
335
|
duplicate(newName) {
|
|
384
|
-
const dest = new Button(
|
|
336
|
+
const dest = new Button({
|
|
337
|
+
...this.getEntityOptions(),
|
|
338
|
+
...this.getDrawableOptions(),
|
|
339
|
+
...this.getTextOptions(),
|
|
385
340
|
size: this.size,
|
|
386
341
|
cornerRadius: this.cornerRadius,
|
|
387
342
|
backgroundColor: this.backgroundColor,
|
|
388
343
|
fontColor: this.fontColor,
|
|
389
344
|
name: newName
|
|
390
|
-
})
|
|
345
|
+
});
|
|
391
346
|
if (this.children.length > 0) {
|
|
392
347
|
dest.children = this.children.map((child) => {
|
|
393
348
|
const clonedChild = child.duplicate();
|
|
@@ -411,12 +366,6 @@ class Button extends Composite {
|
|
|
411
366
|
}
|
|
412
367
|
}
|
|
413
368
|
|
|
414
|
-
var __defProp$1 = Object.defineProperty;
|
|
415
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
416
|
-
var __publicField$1 = (obj, key, value) => {
|
|
417
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
418
|
-
return value;
|
|
419
|
-
};
|
|
420
369
|
var DialogResult = /* @__PURE__ */ ((DialogResult2) => {
|
|
421
370
|
DialogResult2["Dismiss"] = "Dismiss";
|
|
422
371
|
DialogResult2["Positive"] = "Positive";
|
|
@@ -428,17 +377,16 @@ class Dialog extends Composite {
|
|
|
428
377
|
// todo: add default "behaviors" (?) like button click animation?
|
|
429
378
|
constructor(options) {
|
|
430
379
|
super(options);
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
__publicField$1(this, "backgroundPaint");
|
|
380
|
+
this.compositeType = "dialog";
|
|
381
|
+
this._backgroundColor = WebColors.White;
|
|
382
|
+
this.cornerRadius = 9;
|
|
383
|
+
this.overlayAlpha = 0.5;
|
|
384
|
+
this.contentText = "";
|
|
385
|
+
this.positiveButtonText = "";
|
|
386
|
+
this.negativeButtonText = "";
|
|
387
|
+
this.zPosition = Number.MAX_VALUE;
|
|
388
|
+
this.hidden = true;
|
|
389
|
+
this._fontColor = WebColors.White;
|
|
442
390
|
if (!options) {
|
|
443
391
|
return;
|
|
444
392
|
}
|
|
@@ -626,12 +574,510 @@ class Dialog extends Composite {
|
|
|
626
574
|
}
|
|
627
575
|
}
|
|
628
576
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
return value;
|
|
577
|
+
const DrawPadEventType = {
|
|
578
|
+
StrokeStart: "StrokeStart",
|
|
579
|
+
StrokeMove: "StrokeMove",
|
|
580
|
+
StrokeEnd: "StrokeEnd"
|
|
634
581
|
};
|
|
582
|
+
const DrawPadItemEventType = {
|
|
583
|
+
StrokeEnter: "StrokeEnter",
|
|
584
|
+
StrokeLeave: "StrokeLeave"
|
|
585
|
+
};
|
|
586
|
+
class DrawPad extends Composite {
|
|
587
|
+
/**
|
|
588
|
+
* A rectangular area on which the user can draw strokes (lines).
|
|
589
|
+
*
|
|
590
|
+
* @remarks This composite entity is composed of a rectangle Shape and
|
|
591
|
+
* another Shape that is formed from a path of points.
|
|
592
|
+
*
|
|
593
|
+
* @param options - {@link DrawPadOptions}
|
|
594
|
+
*/
|
|
595
|
+
constructor(options) {
|
|
596
|
+
super(options);
|
|
597
|
+
this.compositeType = "DrawPad";
|
|
598
|
+
this.resumeDrawingOnReturn = false;
|
|
599
|
+
this.continuousDrawingOnly = false;
|
|
600
|
+
this._backgroundColor = [0, 0, 0, 0];
|
|
601
|
+
this._borderColor = WebColors.Black;
|
|
602
|
+
this._borderWidth = 1;
|
|
603
|
+
this._lineColor = WebColors.Red;
|
|
604
|
+
this._lineWidth = 1;
|
|
605
|
+
this.isDrawingPointerDown = false;
|
|
606
|
+
this.pointerIsDownAndPointerLeftDrawAreaWhenDown = false;
|
|
607
|
+
this.currentStrokesNotAllowed = false;
|
|
608
|
+
/** Array of strokes created on the DrawPad, with position and timestamps
|
|
609
|
+
* of all interactions with each DrawPadStroke.
|
|
610
|
+
*/
|
|
611
|
+
this.strokes = new Array();
|
|
612
|
+
if (options.isUserInteractionEnabled === void 0) {
|
|
613
|
+
this.isUserInteractionEnabled = true;
|
|
614
|
+
}
|
|
615
|
+
if (!options.size) {
|
|
616
|
+
throw new Error("DrawPad size must be specified");
|
|
617
|
+
}
|
|
618
|
+
this.size = options.size;
|
|
619
|
+
if (options.lineColor) {
|
|
620
|
+
this.lineColor = options.lineColor;
|
|
621
|
+
}
|
|
622
|
+
if (options.lineWidth) {
|
|
623
|
+
this.lineWidth = options.lineWidth;
|
|
624
|
+
}
|
|
625
|
+
if (options.backgroundColor) {
|
|
626
|
+
this.backgroundColor = options.backgroundColor;
|
|
627
|
+
}
|
|
628
|
+
if (options.borderColor) {
|
|
629
|
+
this.borderColor = options.borderColor;
|
|
630
|
+
}
|
|
631
|
+
if (options.borderWidth) {
|
|
632
|
+
this.borderWidth = options.borderWidth;
|
|
633
|
+
}
|
|
634
|
+
if (options.resumeDrawingOnReturn !== void 0) {
|
|
635
|
+
this.resumeDrawingOnReturn = options.resumeDrawingOnReturn;
|
|
636
|
+
}
|
|
637
|
+
if (options.continuousDrawingOnly !== void 0) {
|
|
638
|
+
this.continuousDrawingOnly = options.continuousDrawingOnly;
|
|
639
|
+
}
|
|
640
|
+
if (options.continuousDrawingOnlyExceptionDistance !== void 0) {
|
|
641
|
+
this.continuousDrawingOnlyExceptionDistance = options.continuousDrawingOnlyExceptionDistance;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
initialize() {
|
|
645
|
+
this.initializeDrawShape();
|
|
646
|
+
this.initializeDrawArea();
|
|
647
|
+
this.needsInitialization = false;
|
|
648
|
+
}
|
|
649
|
+
initializeDrawShape() {
|
|
650
|
+
if (!this.drawShape) {
|
|
651
|
+
const mutablePath = new MutablePath();
|
|
652
|
+
this.drawShape = new Shape({
|
|
653
|
+
path: mutablePath,
|
|
654
|
+
size: this.size
|
|
655
|
+
});
|
|
656
|
+
this.addChild(this.drawShape);
|
|
657
|
+
}
|
|
658
|
+
this.drawShape.strokeColor = this.lineColor;
|
|
659
|
+
this.drawShape.lineWidth = this.lineWidth;
|
|
660
|
+
}
|
|
661
|
+
initializeDrawArea() {
|
|
662
|
+
if (!this.drawArea) {
|
|
663
|
+
this.drawArea = new Shape({
|
|
664
|
+
rect: { size: this.size },
|
|
665
|
+
isUserInteractionEnabled: true
|
|
666
|
+
});
|
|
667
|
+
this.addChild(this.drawArea);
|
|
668
|
+
this.drawArea.onTapDown((e) => {
|
|
669
|
+
this.handleTapDown(e);
|
|
670
|
+
});
|
|
671
|
+
this.drawArea.onPointerMove((e) => {
|
|
672
|
+
this.handlePointerMove(e);
|
|
673
|
+
});
|
|
674
|
+
this.drawArea.onTapUpAny(() => {
|
|
675
|
+
this.handleTapUpAny();
|
|
676
|
+
});
|
|
677
|
+
this.drawArea.onTapLeave(() => {
|
|
678
|
+
this.handleTapLeave();
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
this.drawArea.fillColor = this.backgroundColor;
|
|
682
|
+
this.drawArea.strokeColor = this.borderColor;
|
|
683
|
+
this.drawArea.lineWidth = this.borderWidth;
|
|
684
|
+
}
|
|
685
|
+
dist(p1, p2) {
|
|
686
|
+
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
|
687
|
+
}
|
|
688
|
+
handleTapDown(e) {
|
|
689
|
+
if (this.isUserInteractionEnabled) {
|
|
690
|
+
const drawShape = this.drawShape;
|
|
691
|
+
if (!drawShape) {
|
|
692
|
+
throw new Error("no draw shape");
|
|
693
|
+
}
|
|
694
|
+
const path = drawShape.path;
|
|
695
|
+
if (this.continuousDrawingOnly && path.subpaths.length !== 0) {
|
|
696
|
+
const prevPoint = path.subpaths[path.subpaths.length - 1][path.subpaths[path.subpaths.length - 1].length - 1];
|
|
697
|
+
const currentPoint = e.point;
|
|
698
|
+
if (this.continuousDrawingOnlyExceptionDistance === void 0 || this.dist(prevPoint, currentPoint) > this.continuousDrawingOnlyExceptionDistance) {
|
|
699
|
+
this.currentStrokesNotAllowed = true;
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
this.isDrawingPointerDown = true;
|
|
704
|
+
path.move(e.point);
|
|
705
|
+
const drawPadEvent = {
|
|
706
|
+
type: DrawPadEventType.StrokeStart,
|
|
707
|
+
target: this,
|
|
708
|
+
handled: false,
|
|
709
|
+
position: e.point
|
|
710
|
+
};
|
|
711
|
+
this.strokes.push([
|
|
712
|
+
{
|
|
713
|
+
type: DrawPadEventType.StrokeStart,
|
|
714
|
+
position: e.point,
|
|
715
|
+
iso8601Timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
716
|
+
}
|
|
717
|
+
]);
|
|
718
|
+
this.raiseDrawPadEvent(drawPadEvent);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
handleTapLeave() {
|
|
722
|
+
if (this.currentStrokesNotAllowed) {
|
|
723
|
+
this.isDrawingPointerDown = false;
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (this.resumeDrawingOnReturn === false) {
|
|
727
|
+
this.isDrawingPointerDown = false;
|
|
728
|
+
const strokeCount = this.strokes.length;
|
|
729
|
+
const strokeInteractionCount = this.strokes[strokeCount - 1].length;
|
|
730
|
+
const drawPadEvent = {
|
|
731
|
+
type: DrawPadEventType.StrokeEnd,
|
|
732
|
+
position: this.strokes[strokeCount - 1][strokeInteractionCount - 1].position,
|
|
733
|
+
target: this,
|
|
734
|
+
handled: false
|
|
735
|
+
};
|
|
736
|
+
this.strokes[strokeCount - 1].push({
|
|
737
|
+
type: DrawPadEventType.StrokeEnd,
|
|
738
|
+
position: this.strokes[strokeCount - 1][strokeInteractionCount - 1].position,
|
|
739
|
+
iso8601Timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
740
|
+
});
|
|
741
|
+
this.raiseDrawPadEvent(drawPadEvent);
|
|
742
|
+
} else {
|
|
743
|
+
this.pointerIsDownAndPointerLeftDrawAreaWhenDown = true;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
handleTapUpAny() {
|
|
747
|
+
if (this.currentStrokesNotAllowed) {
|
|
748
|
+
this.isDrawingPointerDown = false;
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
if (this.isUserInteractionEnabled) {
|
|
752
|
+
this.isDrawingPointerDown = false;
|
|
753
|
+
this.pointerIsDownAndPointerLeftDrawAreaWhenDown = false;
|
|
754
|
+
const strokeCount = this.strokes.length;
|
|
755
|
+
const strokeInteractionCount = this.strokes[strokeCount - 1].length;
|
|
756
|
+
const drawPadEvent = {
|
|
757
|
+
type: DrawPadEventType.StrokeEnd,
|
|
758
|
+
position: this.strokes[strokeCount - 1][strokeInteractionCount - 1].position,
|
|
759
|
+
target: this,
|
|
760
|
+
handled: false
|
|
761
|
+
};
|
|
762
|
+
this.strokes[strokeCount - 1].push({
|
|
763
|
+
type: DrawPadEventType.StrokeEnd,
|
|
764
|
+
position: this.strokes[strokeCount - 1][strokeInteractionCount - 1].position,
|
|
765
|
+
iso8601Timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
766
|
+
});
|
|
767
|
+
this.raiseDrawPadEvent(drawPadEvent);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
handlePointerMove(e) {
|
|
771
|
+
if (this.isUserInteractionEnabled && this.isDrawingPointerDown) {
|
|
772
|
+
const drawShape = this.drawShape;
|
|
773
|
+
if (!drawShape) {
|
|
774
|
+
throw new Error("no draw shape");
|
|
775
|
+
}
|
|
776
|
+
const path = drawShape.path;
|
|
777
|
+
if (this.isDrawingPointerDown && !this.pointerIsDownAndPointerLeftDrawAreaWhenDown) {
|
|
778
|
+
path.addLine(e.point);
|
|
779
|
+
}
|
|
780
|
+
if (this.pointerIsDownAndPointerLeftDrawAreaWhenDown) {
|
|
781
|
+
this.pointerIsDownAndPointerLeftDrawAreaWhenDown = false;
|
|
782
|
+
path.move(e.point);
|
|
783
|
+
}
|
|
784
|
+
const drawPadEvent = {
|
|
785
|
+
type: DrawPadEventType.StrokeMove,
|
|
786
|
+
target: this,
|
|
787
|
+
handled: false,
|
|
788
|
+
position: e.point
|
|
789
|
+
};
|
|
790
|
+
const strokeCount = this.strokes.length;
|
|
791
|
+
this.strokes[strokeCount - 1].push({
|
|
792
|
+
type: DrawPadEventType.StrokeMove,
|
|
793
|
+
position: e.point,
|
|
794
|
+
iso8601Timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
795
|
+
});
|
|
796
|
+
this.raiseDrawPadEvent(drawPadEvent);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
update() {
|
|
800
|
+
super.update();
|
|
801
|
+
}
|
|
802
|
+
draw(canvas) {
|
|
803
|
+
super.drawChildren(canvas);
|
|
804
|
+
}
|
|
805
|
+
raiseDrawPadEvent(event) {
|
|
806
|
+
if (this.eventListeners.length > 0) {
|
|
807
|
+
this.eventListeners.filter((listener) => listener.type === event.type).forEach((listener) => {
|
|
808
|
+
listener.callback(event);
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
raiseDrawPadItemEvent(item, event) {
|
|
813
|
+
if (item.eventListeners.length > 0) {
|
|
814
|
+
item.eventListeners.filter((listener) => listener.type === event.type).forEach((listener) => {
|
|
815
|
+
listener.callback(event);
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Removes all strokes from the DrawPad.
|
|
821
|
+
*/
|
|
822
|
+
clear() {
|
|
823
|
+
const drawShape = this.drawShape;
|
|
824
|
+
if (!drawShape) {
|
|
825
|
+
throw new Error("no draw shape");
|
|
826
|
+
}
|
|
827
|
+
const path = drawShape.path;
|
|
828
|
+
path.clear();
|
|
829
|
+
this.strokes = new Array();
|
|
830
|
+
}
|
|
831
|
+
warmup(canvas) {
|
|
832
|
+
this.initialize();
|
|
833
|
+
this.children.filter((child) => child.isDrawable).forEach((child) => {
|
|
834
|
+
child.warmup(canvas);
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Executes a callback when the user starts a stroke on the DrawPad.
|
|
839
|
+
*
|
|
840
|
+
* @param callback - function to execute
|
|
841
|
+
* @param options - {@link CallbackOptions}
|
|
842
|
+
*/
|
|
843
|
+
onStrokeStart(callback, options) {
|
|
844
|
+
this.addEventListener(
|
|
845
|
+
DrawPadEventType.StrokeStart,
|
|
846
|
+
callback,
|
|
847
|
+
options
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Executes a callback when the user moves a stroke on the DrawPad.
|
|
852
|
+
*
|
|
853
|
+
* @param callback - function to execute
|
|
854
|
+
* @param options - {@link CallbackOptions}
|
|
855
|
+
*/
|
|
856
|
+
onStrokeMove(callback, options) {
|
|
857
|
+
this.addEventListener(
|
|
858
|
+
DrawPadEventType.StrokeMove,
|
|
859
|
+
callback,
|
|
860
|
+
options
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Executes a callback when the user ends a stroke on the DrawPad.
|
|
865
|
+
*
|
|
866
|
+
* @param callback - function to execute
|
|
867
|
+
* @param options - {@link CallbackOptions}
|
|
868
|
+
*/
|
|
869
|
+
onStrokeEnd(callback, options) {
|
|
870
|
+
this.addEventListener(
|
|
871
|
+
DrawPadEventType.StrokeEnd,
|
|
872
|
+
callback,
|
|
873
|
+
options
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Adds an entity to the DrawPad.
|
|
878
|
+
*
|
|
879
|
+
* @remarks After the entity is added to the DrawPad, its
|
|
880
|
+
* position is adjusted to be relative to the DrawPad's coordinate
|
|
881
|
+
* system, and it is made interactive. The method returns an object
|
|
882
|
+
* which is the entity as a DrawPadItem, which has additional methods,
|
|
883
|
+
* properties, and events specific to it now being on a DrawPad. The entity
|
|
884
|
+
* now **must** be manipulated only using the DrawPadItem object. Using
|
|
885
|
+
* the original entity object will result in undefined behavior.
|
|
886
|
+
*
|
|
887
|
+
* @param entity - the entity to add to the DrawPad
|
|
888
|
+
* @returns the entity as a DrawPadItem
|
|
889
|
+
*/
|
|
890
|
+
addItem(entity) {
|
|
891
|
+
Object.defineProperty(entity, "drawPadPosition", {
|
|
892
|
+
get: function() {
|
|
893
|
+
const drawPad = entity.parent;
|
|
894
|
+
return {
|
|
895
|
+
get x() {
|
|
896
|
+
return entity.position.x + drawPad.size.width / 2;
|
|
897
|
+
},
|
|
898
|
+
set x(value) {
|
|
899
|
+
entity.position.x = value - drawPad.size.width / 2;
|
|
900
|
+
},
|
|
901
|
+
get y() {
|
|
902
|
+
return entity.position.y + drawPad.size.height / 2;
|
|
903
|
+
},
|
|
904
|
+
set y(value) {
|
|
905
|
+
entity.position.y = value - drawPad.size.height / 2;
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
},
|
|
909
|
+
set: function(value) {
|
|
910
|
+
const drawPad = entity.parent;
|
|
911
|
+
entity.position.x = value.x - drawPad.size.width / 2;
|
|
912
|
+
entity.position.y = value.y - drawPad.size.height / 2;
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
Object.defineProperty(entity, "onStrokeEnter", {
|
|
916
|
+
value: function(callback, options) {
|
|
917
|
+
this.addEventListener(
|
|
918
|
+
DrawPadItemEventType.StrokeEnter,
|
|
919
|
+
callback,
|
|
920
|
+
options
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
Object.defineProperty(entity, "onStrokeLeave", {
|
|
925
|
+
value: function(callback, options) {
|
|
926
|
+
this.addEventListener(
|
|
927
|
+
DrawPadItemEventType.StrokeLeave,
|
|
928
|
+
callback,
|
|
929
|
+
options
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
Object.defineProperty(entity, "isStrokeWithinBounds", {
|
|
934
|
+
value: false,
|
|
935
|
+
writable: true
|
|
936
|
+
});
|
|
937
|
+
entity.onPointerDown(() => {
|
|
938
|
+
if (this.isDrawingPointerDown) {
|
|
939
|
+
if (entity.isStrokeWithinBounds === false) {
|
|
940
|
+
entity.isStrokeWithinBounds = true;
|
|
941
|
+
const drawPadItemEvent = {
|
|
942
|
+
type: DrawPadItemEventType.StrokeEnter,
|
|
943
|
+
target: entity
|
|
944
|
+
};
|
|
945
|
+
this.raiseDrawPadItemEvent(entity, drawPadItemEvent);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
entity.onPointerMove(() => {
|
|
950
|
+
if (this.isDrawingPointerDown) {
|
|
951
|
+
if (entity.isStrokeWithinBounds === false) {
|
|
952
|
+
entity.isStrokeWithinBounds = true;
|
|
953
|
+
const drawPadItemEvent = {
|
|
954
|
+
type: DrawPadItemEventType.StrokeEnter,
|
|
955
|
+
target: entity
|
|
956
|
+
};
|
|
957
|
+
this.raiseDrawPadItemEvent(entity, drawPadItemEvent);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
entity.onPointerLeave(() => {
|
|
962
|
+
if (this.isDrawingPointerDown) {
|
|
963
|
+
if (entity.isStrokeWithinBounds === true) {
|
|
964
|
+
entity.isStrokeWithinBounds = false;
|
|
965
|
+
const drawPadItemEvent = {
|
|
966
|
+
type: DrawPadItemEventType.StrokeLeave,
|
|
967
|
+
target: entity
|
|
968
|
+
};
|
|
969
|
+
this.raiseDrawPadItemEvent(entity, drawPadItemEvent);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
entity.onPointerUp(() => {
|
|
974
|
+
if (entity.isStrokeWithinBounds === true) {
|
|
975
|
+
entity.isStrokeWithinBounds = false;
|
|
976
|
+
const drawPadItemEvent = {
|
|
977
|
+
type: DrawPadItemEventType.StrokeLeave,
|
|
978
|
+
target: entity
|
|
979
|
+
};
|
|
980
|
+
this.raiseDrawPadItemEvent(entity, drawPadItemEvent);
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
this.addChild(entity);
|
|
984
|
+
entity.zPosition = -1;
|
|
985
|
+
entity.position.x = entity.position.x - this.size.width / 2;
|
|
986
|
+
entity.position.y = entity.position.y - this.size.height / 2;
|
|
987
|
+
entity.isUserInteractionEnabled = true;
|
|
988
|
+
return entity;
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Takes a screenshot of the DrawPad.
|
|
992
|
+
*
|
|
993
|
+
* @returns a base64-encoded string of the DrawPad's current state in
|
|
994
|
+
* PNG format.
|
|
995
|
+
*/
|
|
996
|
+
takeScreenshot() {
|
|
997
|
+
const surface = this.game.surface;
|
|
998
|
+
if (!surface) {
|
|
999
|
+
throw new Error("no surface");
|
|
1000
|
+
}
|
|
1001
|
+
const drawArea = this.drawArea;
|
|
1002
|
+
if (!drawArea) {
|
|
1003
|
+
throw new Error("no draw area");
|
|
1004
|
+
}
|
|
1005
|
+
const sx = (drawArea.absolutePosition.x - drawArea.size.width / 2) * Globals.canvasScale;
|
|
1006
|
+
const sy = (drawArea.absolutePosition.y - drawArea.size.height / 2) * Globals.canvasScale;
|
|
1007
|
+
const sw = drawArea.size.width * Globals.canvasScale;
|
|
1008
|
+
const sh = drawArea.size.height * Globals.canvasScale;
|
|
1009
|
+
const imageInfo = {
|
|
1010
|
+
alphaType: this.game.canvasKit.AlphaType.Unpremul,
|
|
1011
|
+
colorType: this.game.canvasKit.ColorType.RGBA_8888,
|
|
1012
|
+
colorSpace: this.game.canvasKit.ColorSpace.SRGB,
|
|
1013
|
+
width: sw,
|
|
1014
|
+
height: sh
|
|
1015
|
+
};
|
|
1016
|
+
const snapshot = this.game.snapshots[0];
|
|
1017
|
+
const pixelData = snapshot.readPixels(sx, sy, imageInfo);
|
|
1018
|
+
const croppedImage = this.game.canvasKit.MakeImage(
|
|
1019
|
+
imageInfo,
|
|
1020
|
+
pixelData,
|
|
1021
|
+
pixelData.length / sh
|
|
1022
|
+
);
|
|
1023
|
+
if (!croppedImage) {
|
|
1024
|
+
throw new Error("no cropped image");
|
|
1025
|
+
}
|
|
1026
|
+
const bytes = croppedImage.encodeToBytes();
|
|
1027
|
+
if (!bytes) {
|
|
1028
|
+
throw new Error("no bytes");
|
|
1029
|
+
}
|
|
1030
|
+
croppedImage.delete();
|
|
1031
|
+
return this.arrayBufferToBase64String(bytes);
|
|
1032
|
+
}
|
|
1033
|
+
arrayBufferToBase64String(buffer) {
|
|
1034
|
+
let binary = "";
|
|
1035
|
+
const bytes = new Uint8Array(buffer);
|
|
1036
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1037
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1038
|
+
}
|
|
1039
|
+
return window.btoa(binary);
|
|
1040
|
+
}
|
|
1041
|
+
get backgroundColor() {
|
|
1042
|
+
return this._backgroundColor;
|
|
1043
|
+
}
|
|
1044
|
+
set backgroundColor(backgroundColor) {
|
|
1045
|
+
this._backgroundColor = backgroundColor;
|
|
1046
|
+
this.needsInitialization = true;
|
|
1047
|
+
}
|
|
1048
|
+
get borderColor() {
|
|
1049
|
+
return this._borderColor;
|
|
1050
|
+
}
|
|
1051
|
+
set borderColor(borderColor) {
|
|
1052
|
+
this._borderColor = borderColor;
|
|
1053
|
+
this.needsInitialization = true;
|
|
1054
|
+
}
|
|
1055
|
+
get borderWidth() {
|
|
1056
|
+
return this._borderWidth;
|
|
1057
|
+
}
|
|
1058
|
+
set borderWidth(borderWidth) {
|
|
1059
|
+
this._borderWidth = borderWidth;
|
|
1060
|
+
this.needsInitialization = true;
|
|
1061
|
+
}
|
|
1062
|
+
get lineColor() {
|
|
1063
|
+
return this._lineColor;
|
|
1064
|
+
}
|
|
1065
|
+
set lineColor(lineColor) {
|
|
1066
|
+
this._lineColor = lineColor;
|
|
1067
|
+
this.needsInitialization = true;
|
|
1068
|
+
}
|
|
1069
|
+
get lineWidth() {
|
|
1070
|
+
return this._lineWidth;
|
|
1071
|
+
}
|
|
1072
|
+
set lineWidth(lineWidth) {
|
|
1073
|
+
this._lineWidth = lineWidth;
|
|
1074
|
+
this.needsInitialization = true;
|
|
1075
|
+
}
|
|
1076
|
+
duplicate(newName) {
|
|
1077
|
+
throw new Error("Method not implemented.");
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
|
|
635
1081
|
class VirtualKeyboard extends Composite {
|
|
636
1082
|
/**
|
|
637
1083
|
* An on-screen keyboard that can be used to enter text.
|
|
@@ -639,31 +1085,15 @@ class VirtualKeyboard extends Composite {
|
|
|
639
1085
|
* @param options - {@link VirtualKeyboardOptions}
|
|
640
1086
|
*/
|
|
641
1087
|
constructor(options) {
|
|
642
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
643
1088
|
super(options);
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
__publicField(this, "keyHorizontalPaddingPercent");
|
|
647
|
-
__publicField(this, "keyVerticalPaddingPercent");
|
|
648
|
-
__publicField(this, "rowsConfiguration", new Array());
|
|
649
|
-
__publicField(this, "keysPerRow");
|
|
650
|
-
__publicField(this, "fontSize");
|
|
651
|
-
__publicField(this, "fontNames");
|
|
652
|
-
__publicField(this, "hiddenKeys");
|
|
653
|
-
__publicField(this, "capitalLettersOnly");
|
|
654
|
-
__publicField(this, "keyColor");
|
|
655
|
-
__publicField(this, "keyDownColor");
|
|
656
|
-
__publicField(this, "specialKeyDownColor");
|
|
657
|
-
__publicField(this, "backgroundColor");
|
|
658
|
-
__publicField(this, "showKeyDownPreview");
|
|
659
|
-
__publicField(this, "shiftActivated", false);
|
|
660
|
-
__publicField(this, "shiftKeyShape");
|
|
1089
|
+
this.rowsConfiguration = new Array();
|
|
1090
|
+
this.shiftActivated = false;
|
|
661
1091
|
this.size = options.size;
|
|
662
|
-
this.position =
|
|
663
|
-
this.keyboardHorizontalPaddingPercent =
|
|
664
|
-
this.keyboardVerticalPaddingPercent =
|
|
665
|
-
this.keyHorizontalPaddingPercent =
|
|
666
|
-
this.keyVerticalPaddingPercent =
|
|
1092
|
+
this.position = options.position ?? { x: 0, y: 0 };
|
|
1093
|
+
this.keyboardHorizontalPaddingPercent = options.keyboardHorizontalPaddingPercent ?? 0.02;
|
|
1094
|
+
this.keyboardVerticalPaddingPercent = options.keyboardVerticalPaddingPercent ?? 0.025;
|
|
1095
|
+
this.keyHorizontalPaddingPercent = options.keyHorizontalPaddingPercent ?? 0.1;
|
|
1096
|
+
this.keyVerticalPaddingPercent = options.keyVerticalPaddingPercent ?? 0.1;
|
|
667
1097
|
if (options.rows !== void 0) {
|
|
668
1098
|
this.rowsConfiguration = options.rows.map((row) => {
|
|
669
1099
|
const internalRow = row.map((key) => {
|
|
@@ -681,19 +1111,18 @@ class VirtualKeyboard extends Composite {
|
|
|
681
1111
|
return internalRow;
|
|
682
1112
|
});
|
|
683
1113
|
}
|
|
684
|
-
this.keysPerRow =
|
|
685
|
-
this.fontSize =
|
|
1114
|
+
this.keysPerRow = options.keysPerRow ?? NaN;
|
|
1115
|
+
this.fontSize = options.fontSize ?? NaN;
|
|
686
1116
|
this.fontNames = options.fontNames;
|
|
687
|
-
this.hiddenKeys =
|
|
688
|
-
this.capitalLettersOnly =
|
|
689
|
-
this.keyColor =
|
|
690
|
-
this.keyDownColor =
|
|
691
|
-
this.specialKeyDownColor =
|
|
692
|
-
this.backgroundColor =
|
|
693
|
-
this.showKeyDownPreview =
|
|
1117
|
+
this.hiddenKeys = options.hiddenKeys ?? "";
|
|
1118
|
+
this.capitalLettersOnly = options.capitalLettersOnly ?? false;
|
|
1119
|
+
this.keyColor = options.keyColor ?? WebColors.White;
|
|
1120
|
+
this.keyDownColor = options.keyDownColor ?? WebColors.Transparent;
|
|
1121
|
+
this.specialKeyDownColor = options.specialKeyDownColor ?? WebColors.LightSteelBlue;
|
|
1122
|
+
this.backgroundColor = options.backgroundColor ?? [242, 240, 244, 1];
|
|
1123
|
+
this.showKeyDownPreview = options.showKeyDownPreview ?? true;
|
|
694
1124
|
}
|
|
695
1125
|
initialize() {
|
|
696
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
697
1126
|
if (this.rowsConfiguration.length === 0) {
|
|
698
1127
|
const numKeys = [
|
|
699
1128
|
["1", "!"],
|
|
@@ -733,7 +1162,7 @@ class VirtualKeyboard extends Composite {
|
|
|
733
1162
|
const shiftArrowShapeOptions = {
|
|
734
1163
|
path: {
|
|
735
1164
|
// Public Domain from https://www.freesvg.org
|
|
736
|
-
|
|
1165
|
+
pathString: "m288-6.6849e-14 -288 288h144v288h288v-288h144l-288-288z",
|
|
737
1166
|
width: 24
|
|
738
1167
|
},
|
|
739
1168
|
lineWidth: 2,
|
|
@@ -743,7 +1172,7 @@ class VirtualKeyboard extends Composite {
|
|
|
743
1172
|
const backspaceShapeOptions = {
|
|
744
1173
|
path: {
|
|
745
1174
|
// CC0 from https://www.svgrepo.com
|
|
746
|
-
|
|
1175
|
+
pathString: "M10.625 5.09 0 22.09l10.625 17H44.18v-34H10.625zm31.555 32H11.734l-9.375-15 9.375-15H42.18v30zm-23.293-6.293 7.293-7.293 7.293 7.293 1.414-1.414-7.293-7.293 7.293-7.293-1.414-1.414-7.293 7.293-7.293-7.293-1.414 1.414 7.293 7.293-7.293 7.293",
|
|
747
1176
|
width: 24
|
|
748
1177
|
},
|
|
749
1178
|
lineWidth: 1,
|
|
@@ -794,7 +1223,6 @@ class VirtualKeyboard extends Composite {
|
|
|
794
1223
|
this.addChild(keyboardRectangle);
|
|
795
1224
|
const rows = this.rowsConfiguration.map((row) => {
|
|
796
1225
|
return row.map((key) => {
|
|
797
|
-
var _a2, _b2, _c2, _d2;
|
|
798
1226
|
let widthRatio = 1;
|
|
799
1227
|
const heightRatio = 1;
|
|
800
1228
|
let code;
|
|
@@ -816,11 +1244,11 @@ class VirtualKeyboard extends Composite {
|
|
|
816
1244
|
labelShifted = key[1];
|
|
817
1245
|
} else {
|
|
818
1246
|
code = key.code;
|
|
819
|
-
label =
|
|
820
|
-
labelShifted =
|
|
821
|
-
widthRatio =
|
|
1247
|
+
label = key.labelText ?? "";
|
|
1248
|
+
labelShifted = key.labelTextShifted ?? label;
|
|
1249
|
+
widthRatio = key.widthRatio ?? 1;
|
|
822
1250
|
keyIcon = key.keyIcon;
|
|
823
|
-
isShift =
|
|
1251
|
+
isShift = key.isShift ?? false;
|
|
824
1252
|
}
|
|
825
1253
|
return {
|
|
826
1254
|
widthRatio,
|
|
@@ -837,17 +1265,14 @@ class VirtualKeyboard extends Composite {
|
|
|
837
1265
|
x: -keyboardRectangle.size.width / 2,
|
|
838
1266
|
y: -keyboardRectangle.size.height / 2
|
|
839
1267
|
};
|
|
840
|
-
const keyboardVerticalPadding = (
|
|
841
|
-
const keyboardHorizontalPadding = (
|
|
1268
|
+
const keyboardVerticalPadding = (this.keyboardVerticalPaddingPercent ?? 0.025) * this.size.height;
|
|
1269
|
+
const keyboardHorizontalPadding = (this.keyboardHorizontalPaddingPercent ?? 0.02) * this.size.width;
|
|
842
1270
|
const keyBoxHeight = (this.size.height - 2 * keyboardVerticalPadding) / rows.length;
|
|
843
1271
|
const keyBoxWidth = (this.size.width - 2 * keyboardHorizontalPadding) / this.keysPerRow;
|
|
844
1272
|
for (let r = 0; r < rows.length; r++) {
|
|
845
1273
|
const row = rows[r];
|
|
846
1274
|
const rowSumKeyWidths = row.reduce(
|
|
847
|
-
(sum, key) =>
|
|
848
|
-
var _a2;
|
|
849
|
-
return sum + ((_a2 = key.widthRatio) != null ? _a2 : 1);
|
|
850
|
-
},
|
|
1275
|
+
(sum, key) => sum + (key.widthRatio ?? 1),
|
|
851
1276
|
0
|
|
852
1277
|
);
|
|
853
1278
|
let extraPadding = 0;
|
|
@@ -856,17 +1281,14 @@ class VirtualKeyboard extends Composite {
|
|
|
856
1281
|
}
|
|
857
1282
|
for (let k = 0; k < row.length; k++) {
|
|
858
1283
|
const key = row[k];
|
|
859
|
-
if (
|
|
1284
|
+
if (this.hiddenKeys?.split(",").map((s) => s.trim()).includes(key.code)) {
|
|
860
1285
|
continue;
|
|
861
1286
|
}
|
|
862
|
-
const keyBoxWidthsSoFar = row.slice(0, k).reduce((sum, key2) =>
|
|
863
|
-
var _a2;
|
|
864
|
-
return sum + ((_a2 = key2.widthRatio) != null ? _a2 : 1);
|
|
865
|
-
}, 0) * keyBoxWidth;
|
|
1287
|
+
const keyBoxWidthsSoFar = row.slice(0, k).reduce((sum, key2) => sum + (key2.widthRatio ?? 1), 0) * keyBoxWidth;
|
|
866
1288
|
const keyBox = new Shape({
|
|
867
1289
|
rect: {
|
|
868
1290
|
size: {
|
|
869
|
-
width: keyBoxWidth * (
|
|
1291
|
+
width: keyBoxWidth * (key.widthRatio ?? 1),
|
|
870
1292
|
height: keyBoxHeight
|
|
871
1293
|
}
|
|
872
1294
|
},
|
|
@@ -874,12 +1296,12 @@ class VirtualKeyboard extends Composite {
|
|
|
874
1296
|
strokeColor: WebColors.Transparent,
|
|
875
1297
|
lineWidth: 1,
|
|
876
1298
|
position: {
|
|
877
|
-
x: extraPadding + keyboardOrigin.x + keyboardHorizontalPadding + keyBoxWidthsSoFar + (
|
|
1299
|
+
x: extraPadding + keyboardOrigin.x + keyboardHorizontalPadding + keyBoxWidthsSoFar + (key.widthRatio ?? 1) * keyBoxWidth / 2,
|
|
878
1300
|
y: keyboardOrigin.y + keyboardVerticalPadding + r * keyBoxHeight + keyBoxHeight / 2
|
|
879
1301
|
}
|
|
880
1302
|
});
|
|
881
|
-
const keyWidth = keyBoxWidth * (
|
|
882
|
-
const keyHeight = keyBoxHeight - (
|
|
1303
|
+
const keyWidth = keyBoxWidth * (key.widthRatio ?? 1) - 2 * this.keyHorizontalPaddingPercent * keyBoxWidth;
|
|
1304
|
+
const keyHeight = keyBoxHeight - (key.heightRatio ?? 1) - 2 * this.keyVerticalPaddingPercent * keyBoxHeight;
|
|
883
1305
|
const keyShape = new Shape({
|
|
884
1306
|
rect: { size: { width: keyWidth, height: keyHeight } },
|
|
885
1307
|
cornerRadius: 4,
|
|
@@ -889,7 +1311,6 @@ class VirtualKeyboard extends Composite {
|
|
|
889
1311
|
});
|
|
890
1312
|
keyBox.addChild(keyShape);
|
|
891
1313
|
keyShape.onTapUp((tapEvent) => {
|
|
892
|
-
var _a2, _b2;
|
|
893
1314
|
let keyAsString = "";
|
|
894
1315
|
if (!key.isShift) {
|
|
895
1316
|
if (this.shiftActivated) {
|
|
@@ -901,14 +1322,13 @@ class VirtualKeyboard extends Composite {
|
|
|
901
1322
|
}
|
|
902
1323
|
}
|
|
903
1324
|
rows.flatMap((k2) => k2).forEach((k2) => {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
k2.keyLabel.text = (_b3 = k2.labelText) != null ? _b3 : "";
|
|
1325
|
+
if (k2.keyLabel?.text !== void 0) {
|
|
1326
|
+
k2.keyLabel.text = k2.labelText ?? "";
|
|
907
1327
|
}
|
|
908
1328
|
});
|
|
909
|
-
keyAsString =
|
|
1329
|
+
keyAsString = key.labelTextShifted ?? key.code;
|
|
910
1330
|
} else {
|
|
911
|
-
keyAsString =
|
|
1331
|
+
keyAsString = key.labelText ?? key.code;
|
|
912
1332
|
}
|
|
913
1333
|
if (key.code === " " || key.code === "Backspace") {
|
|
914
1334
|
keyAsString = key.code;
|
|
@@ -945,7 +1365,6 @@ class VirtualKeyboard extends Composite {
|
|
|
945
1365
|
}
|
|
946
1366
|
});
|
|
947
1367
|
keyShape.onTapDown((tapEvent) => {
|
|
948
|
-
var _a2, _b2, _c2, _d2;
|
|
949
1368
|
if (key.isShift) {
|
|
950
1369
|
this.shiftActivated = !this.shiftActivated;
|
|
951
1370
|
if (this.shiftActivated) {
|
|
@@ -954,9 +1373,8 @@ class VirtualKeyboard extends Composite {
|
|
|
954
1373
|
key.keyIcon.fillColor = WebColors.Black;
|
|
955
1374
|
}
|
|
956
1375
|
rows.flatMap((k2) => k2).forEach((k2) => {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
k2.keyLabel.text = (_c3 = (_b3 = k2.labelTextShifted) != null ? _b3 : k2.labelText) != null ? _c3 : "";
|
|
1376
|
+
if (k2.keyLabel?.text !== void 0) {
|
|
1377
|
+
k2.keyLabel.text = k2.labelTextShifted ?? k2.labelText ?? "";
|
|
960
1378
|
}
|
|
961
1379
|
});
|
|
962
1380
|
} else {
|
|
@@ -965,9 +1383,8 @@ class VirtualKeyboard extends Composite {
|
|
|
965
1383
|
key.keyIcon.fillColor = WebColors.Transparent;
|
|
966
1384
|
}
|
|
967
1385
|
rows.flatMap((k2) => k2).forEach((k2) => {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
k2.keyLabel.text = (_b3 = k2.labelText) != null ? _b3 : "";
|
|
1386
|
+
if (k2.keyLabel?.text !== void 0) {
|
|
1387
|
+
k2.keyLabel.text = k2.labelText ?? "";
|
|
971
1388
|
}
|
|
972
1389
|
});
|
|
973
1390
|
}
|
|
@@ -983,15 +1400,15 @@ class VirtualKeyboard extends Composite {
|
|
|
983
1400
|
letterCircle.position.x = keyBox.position.x;
|
|
984
1401
|
letterCircle.position.y = keyBox.position.y - keyHeight * 1.2;
|
|
985
1402
|
if (this.shiftActivated) {
|
|
986
|
-
letterCircleLabel.text =
|
|
1403
|
+
letterCircleLabel.text = key.labelTextShifted ?? key.code;
|
|
987
1404
|
} else {
|
|
988
|
-
letterCircleLabel.text =
|
|
1405
|
+
letterCircleLabel.text = key.labelText ?? key.code;
|
|
989
1406
|
}
|
|
990
1407
|
}
|
|
991
1408
|
if (this.shiftActivated) {
|
|
992
|
-
keyAsString =
|
|
1409
|
+
keyAsString = key.labelTextShifted ?? key.code;
|
|
993
1410
|
} else {
|
|
994
|
-
keyAsString =
|
|
1411
|
+
keyAsString = key.labelText ?? key.code;
|
|
995
1412
|
}
|
|
996
1413
|
}
|
|
997
1414
|
if (this.eventListeners.length > 0) {
|
|
@@ -1130,38 +1547,37 @@ class Instructions extends Story {
|
|
|
1130
1547
|
static Create(options) {
|
|
1131
1548
|
const scenes = new Array();
|
|
1132
1549
|
options.instructionScenes.forEach((s, i) => {
|
|
1133
|
-
|
|
1134
|
-
const nextSceneTransition = (_b = (_a = s.nextSceneTransition) != null ? _a : options.nextSceneTransition) != null ? _b : Transition.slide({
|
|
1550
|
+
const nextSceneTransition = s.nextSceneTransition ?? options.nextSceneTransition ?? Transition.slide({
|
|
1135
1551
|
direction: TransitionDirection.Left,
|
|
1136
1552
|
duration: SCENE_TRANSITION_DURATION,
|
|
1137
1553
|
easing: SCENE_TRANSITION_EASING
|
|
1138
1554
|
});
|
|
1139
|
-
const backSceneTransition =
|
|
1555
|
+
const backSceneTransition = s.backSceneTransition ?? options.backSceneTransition ?? Transition.slide({
|
|
1140
1556
|
direction: TransitionDirection.Right,
|
|
1141
1557
|
duration: SCENE_TRANSITION_DURATION,
|
|
1142
1558
|
easing: SCENE_TRANSITION_EASING
|
|
1143
1559
|
});
|
|
1144
|
-
const backButtonText =
|
|
1145
|
-
const nextButtonText =
|
|
1146
|
-
const backButtonWidth =
|
|
1147
|
-
const nextButtonWidth =
|
|
1148
|
-
const backButtonHeight =
|
|
1149
|
-
const nextButtonHeight =
|
|
1150
|
-
const backgroundColor =
|
|
1151
|
-
const imageAboveText =
|
|
1152
|
-
const imageMarginTop =
|
|
1153
|
-
const imageMarginBottom =
|
|
1154
|
-
const textMarginStart =
|
|
1155
|
-
const textMarginEnd =
|
|
1156
|
-
const textAlignmentMode =
|
|
1157
|
-
const textFontSize =
|
|
1158
|
-
const titleFontSize =
|
|
1159
|
-
const titleMarginTop =
|
|
1160
|
-
const backButtonBackgroundColor =
|
|
1161
|
-
const backButtonFontColor =
|
|
1162
|
-
const nextButtonBackgroundColor =
|
|
1163
|
-
const nextButtonFontColor =
|
|
1164
|
-
const sceneNamePrefix =
|
|
1560
|
+
const backButtonText = s.backButtonText ?? options.backButtonText ?? "Back";
|
|
1561
|
+
const nextButtonText = s.nextButtonText ?? options.nextButtonText ?? "Next";
|
|
1562
|
+
const backButtonWidth = s.backButtonWidth ?? options.backButtonWidth ?? 125;
|
|
1563
|
+
const nextButtonWidth = s.nextButtonWidth ?? options.nextButtonWidth ?? 125;
|
|
1564
|
+
const backButtonHeight = s.backButtonHeight ?? options.backButtonHeight ?? 50;
|
|
1565
|
+
const nextButtonHeight = s.nextButtonHeight ?? options.nextButtonHeight ?? 50;
|
|
1566
|
+
const backgroundColor = s.backgroundColor ?? options.backgroundColor;
|
|
1567
|
+
const imageAboveText = s.imageAboveText ?? true;
|
|
1568
|
+
const imageMarginTop = s.imageMarginTop ?? 0;
|
|
1569
|
+
const imageMarginBottom = s.imageMarginBottom ?? 0;
|
|
1570
|
+
const textMarginStart = s.textMarginStart ?? 48;
|
|
1571
|
+
const textMarginEnd = s.textMarginEnd ?? 48;
|
|
1572
|
+
const textAlignmentMode = s.textAlignmentMode ?? LabelHorizontalAlignmentMode.Left;
|
|
1573
|
+
const textFontSize = s.textFontSize ?? 16;
|
|
1574
|
+
const titleFontSize = s.titleFontSize ?? 16;
|
|
1575
|
+
const titleMarginTop = s.titleMarginTop ?? 48;
|
|
1576
|
+
const backButtonBackgroundColor = s.backButtonBackgroundColor ?? options.backButtonBackgroundColor ?? WebColors.Black;
|
|
1577
|
+
const backButtonFontColor = s.backButtonFontColor ?? options.backButtonFontColor ?? WebColors.White;
|
|
1578
|
+
const nextButtonBackgroundColor = s.nextButtonBackgroundColor ?? options.nextButtonBackgroundColor ?? WebColors.Black;
|
|
1579
|
+
const nextButtonFontColor = s.nextButtonFontColor ?? options.nextButtonFontColor ?? WebColors.White;
|
|
1580
|
+
const sceneNamePrefix = options.sceneNamePrefix ?? "instructions";
|
|
1165
1581
|
const scene = new Scene({
|
|
1166
1582
|
name: sceneNamePrefix + "-" + (i + 1).toString().padStart(2, "0"),
|
|
1167
1583
|
backgroundColor
|
|
@@ -1291,9 +1707,8 @@ class Instructions extends Story {
|
|
|
1291
1707
|
} else {
|
|
1292
1708
|
if (options.postInstructionsScene !== void 0) {
|
|
1293
1709
|
nextButton.onTapDown(() => {
|
|
1294
|
-
var _a2;
|
|
1295
1710
|
scene.game.presentScene(
|
|
1296
|
-
|
|
1711
|
+
options.postInstructionsScene ?? "",
|
|
1297
1712
|
nextSceneTransition
|
|
1298
1713
|
);
|
|
1299
1714
|
});
|
|
@@ -1327,7 +1742,7 @@ class Instructions extends Story {
|
|
|
1327
1742
|
}
|
|
1328
1743
|
}
|
|
1329
1744
|
|
|
1330
|
-
console.log("\u26AA @m2c2kit/addons version 0.3.
|
|
1745
|
+
console.log("\u26AA @m2c2kit/addons version 0.3.11 (60325bea)");
|
|
1331
1746
|
|
|
1332
|
-
export { Button, Dialog, DialogResult, Grid, Instructions, VirtualKeyboard };
|
|
1747
|
+
export { Button, Dialog, DialogResult, DrawPad, DrawPadEventType, DrawPadItemEventType, Grid, Instructions, VirtualKeyboard };
|
|
1333
1748
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2c2kit/addons",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Additions to m2c2kit core functionality, such as button, grid, and instructions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://m2c2-project.github.io/m2c2kit",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@m2c2kit/core": "^0.3.
|
|
33
|
+
"@m2c2kit/core": "^0.3.14"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@rollup/plugin-replace": "5.0.
|
|
37
|
-
"rimraf": "5.0.
|
|
38
|
-
"rollup": "
|
|
39
|
-
"rollup-plugin-copy": "3.
|
|
40
|
-
"rollup-plugin-dts": "
|
|
41
|
-
"rollup-plugin-esbuild": "
|
|
42
|
-
"typescript": "5.
|
|
36
|
+
"@rollup/plugin-replace": "5.0.5",
|
|
37
|
+
"rimraf": "5.0.5",
|
|
38
|
+
"rollup": "4.6.1",
|
|
39
|
+
"rollup-plugin-copy": "3.5.0",
|
|
40
|
+
"rollup-plugin-dts": "6.1.0",
|
|
41
|
+
"rollup-plugin-esbuild": "6.1.0",
|
|
42
|
+
"typescript": "5.3.2"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=18"
|