scandit-datacapture-frameworks-core 6.21.0-beta.2
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/dts/BaseController.d.ts +12 -0
- package/dist/dts/EventEmitter.d.ts +3 -0
- package/dist/dts/Expiration.d.ts +5 -0
- package/dist/dts/FactoryMaker.d.ts +12 -0
- package/dist/dts/LicenseInfo.d.ts +6 -0
- package/dist/dts/camera/Camera.d.ts +44 -0
- package/dist/dts/camera/CameraController.d.ts +30 -0
- package/dist/dts/camera/CameraPosition.d.ts +5 -0
- package/dist/dts/camera/CameraSettings.d.ts +39 -0
- package/dist/dts/camera/FocusGesture.d.ts +2 -0
- package/dist/dts/camera/FocusGestureStrategy.d.ts +6 -0
- package/dist/dts/camera/FocusRange.d.ts +5 -0
- package/dist/dts/camera/LogoStyle.d.ts +4 -0
- package/dist/dts/camera/PrivateFocusGestureDeserializer.d.ts +7 -0
- package/dist/dts/camera/SwipeToZoom.d.ts +6 -0
- package/dist/dts/camera/TapToFocus.d.ts +6 -0
- package/dist/dts/camera/TorchState.d.ts +5 -0
- package/dist/dts/camera/TorchSwitchControl.d.ts +15 -0
- package/dist/dts/camera/VideoResolution.d.ts +6 -0
- package/dist/dts/camera/ZoomGesture.d.ts +8 -0
- package/dist/dts/camera/ZoomSwitchControl.d.ts +15 -0
- package/dist/dts/camera/index.d.ts +16 -0
- package/dist/dts/common/Anchor.d.ts +11 -0
- package/dist/dts/common/Brush.d.ts +28 -0
- package/dist/dts/common/Color.d.ts +26 -0
- package/dist/dts/common/Direction.d.ts +9 -0
- package/dist/dts/common/MarginsWithUnit.d.ts +25 -0
- package/dist/dts/common/MeasureUnit.d.ts +5 -0
- package/dist/dts/common/NumberWithUnit.d.ts +17 -0
- package/dist/dts/common/Orientation.d.ts +7 -0
- package/dist/dts/common/Payload.d.ts +11 -0
- package/dist/dts/common/Point.d.ts +16 -0
- package/dist/dts/common/PointWithUnit.d.ts +19 -0
- package/dist/dts/common/Quadrilateral.d.ts +23 -0
- package/dist/dts/common/Rect.d.ts +10 -0
- package/dist/dts/common/RectWithUnit.d.ts +10 -0
- package/dist/dts/common/Size.d.ts +16 -0
- package/dist/dts/common/SizeWithAspect.d.ts +9 -0
- package/dist/dts/common/SizeWithUnit.d.ts +9 -0
- package/dist/dts/common/SizeWithUnitAndAspect.d.ts +31 -0
- package/dist/dts/common/SizingMode.d.ts +6 -0
- package/dist/dts/common/index.d.ts +42 -0
- package/dist/dts/context/ContextStatus.d.ts +17 -0
- package/dist/dts/context/DataCaptureComponent.d.ts +7 -0
- package/dist/dts/context/DataCaptureContext.d.ts +50 -0
- package/dist/dts/context/DataCaptureContextController.d.ts +30 -0
- package/dist/dts/context/DataCaptureContextCreationOptions.d.ts +3 -0
- package/dist/dts/context/DataCaptureContextListener.d.ts +6 -0
- package/dist/dts/context/DataCaptureContextSettings.d.ts +6 -0
- package/dist/dts/context/DataCaptureMode.d.ts +9 -0
- package/dist/dts/context/index.d.ts +11 -0
- package/dist/dts/defaults/CoreDefaults.d.ts +73 -0
- package/dist/dts/defaults/getCoreDefaults.d.ts +2 -0
- package/dist/dts/defaults/index.d.ts +2 -0
- package/dist/dts/defaults/loadCoreDefaults.d.ts +1 -0
- package/dist/dts/feedback/Feedback.d.ts +22 -0
- package/dist/dts/feedback/FeedbackController.d.ts +11 -0
- package/dist/dts/feedback/Sound.d.ts +13 -0
- package/dist/dts/feedback/Vibration.d.ts +30 -0
- package/dist/dts/feedback/index.d.ts +7 -0
- package/dist/dts/frame/FrameData.d.ts +16 -0
- package/dist/dts/frame/FrameSource.d.ts +14 -0
- package/dist/dts/frame/FrameSourceListener.d.ts +5 -0
- package/dist/dts/frame/FrameSourceState.d.ts +11 -0
- package/dist/dts/frame/ImageBuffer.d.ts +18 -0
- package/dist/dts/frame/ImageFrameSource.d.ts +41 -0
- package/dist/dts/frame/ImageFrameSourceController.d.ts +19 -0
- package/dist/dts/frame/index.d.ts +9 -0
- package/dist/dts/index.d.ts +16 -0
- package/dist/dts/locationselection/LocationSelection.d.ts +2 -0
- package/dist/dts/locationselection/NoneLocationSelection.d.ts +3 -0
- package/dist/dts/locationselection/RadiusLocationSelection.d.ts +16 -0
- package/dist/dts/locationselection/RectangularLocationSelection.d.ts +18 -0
- package/dist/dts/locationselection/index.d.ts +6 -0
- package/dist/dts/serializable/DefaultSerializable.d.ts +4 -0
- package/dist/dts/serializable/Serializable.d.ts +3 -0
- package/dist/dts/serializable/StringSerializable.d.ts +3 -0
- package/dist/dts/serializable/ignoreFromSerialization.d.ts +1 -0
- package/dist/dts/serializable/ignoreFromSerializationIfNull.d.ts +1 -0
- package/dist/dts/serializable/index.d.ts +7 -0
- package/dist/dts/serializable/nameForSerialization.d.ts +1 -0
- package/dist/dts/serializable/serializationDefault.d.ts +1 -0
- package/dist/dts/view/Control.d.ts +6 -0
- package/dist/dts/view/DataCaptureOverlay.d.ts +6 -0
- package/dist/dts/view/DataCaptureView.d.ts +44 -0
- package/dist/dts/view/DataCaptureViewController.d.ts +29 -0
- package/dist/dts/view/DataCaptureViewListener.d.ts +5 -0
- package/dist/dts/view/index.d.ts +5 -0
- package/dist/dts/viewfinder/AimerViewfinder.d.ts +10 -0
- package/dist/dts/viewfinder/LaserlineViewfinder.d.ts +15 -0
- package/dist/dts/viewfinder/LaserlineViewfinderStyle.d.ts +4 -0
- package/dist/dts/viewfinder/NoViewfinder.d.ts +3 -0
- package/dist/dts/viewfinder/RectangularViewfinder.d.ts +36 -0
- package/dist/dts/viewfinder/RectangularViewfinderAnimation.d.ts +13 -0
- package/dist/dts/viewfinder/RectangularViewfinderLineStyle.d.ts +4 -0
- package/dist/dts/viewfinder/RectangularViewfinderStyle.d.ts +5 -0
- package/dist/dts/viewfinder/SpotlightViewfinder.d.ts +19 -0
- package/dist/dts/viewfinder/Viewfinder.d.ts +2 -0
- package/dist/dts/viewfinder/index.d.ts +11 -0
- package/dist/index.js +2575 -0
- package/dist/index.js.map +1 -0
- package/package.json +22 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2575 @@
|
|
|
1
|
+
function getDefaultExportFromCjs (x) {
|
|
2
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
var eventemitter3 = {exports: {}};
|
|
6
|
+
|
|
7
|
+
(function (module) {
|
|
8
|
+
|
|
9
|
+
var has = Object.prototype.hasOwnProperty
|
|
10
|
+
, prefix = '~';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Constructor to create a storage for our `EE` objects.
|
|
14
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
15
|
+
*
|
|
16
|
+
* @constructor
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
function Events() {}
|
|
20
|
+
|
|
21
|
+
//
|
|
22
|
+
// We try to not inherit from `Object.prototype`. In some engines creating an
|
|
23
|
+
// instance in this way is faster than calling `Object.create(null)` directly.
|
|
24
|
+
// If `Object.create(null)` is not supported we prefix the event names with a
|
|
25
|
+
// character to make sure that the built-in object properties are not
|
|
26
|
+
// overridden or used as an attack vector.
|
|
27
|
+
//
|
|
28
|
+
if (Object.create) {
|
|
29
|
+
Events.prototype = Object.create(null);
|
|
30
|
+
|
|
31
|
+
//
|
|
32
|
+
// This hack is needed because the `__proto__` property is still inherited in
|
|
33
|
+
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
|
|
34
|
+
//
|
|
35
|
+
if (!new Events().__proto__) prefix = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Representation of a single event listener.
|
|
40
|
+
*
|
|
41
|
+
* @param {Function} fn The listener function.
|
|
42
|
+
* @param {*} context The context to invoke the listener with.
|
|
43
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
44
|
+
* @constructor
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
function EE(fn, context, once) {
|
|
48
|
+
this.fn = fn;
|
|
49
|
+
this.context = context;
|
|
50
|
+
this.once = once || false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Add a listener for a given event.
|
|
55
|
+
*
|
|
56
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
57
|
+
* @param {(String|Symbol)} event The event name.
|
|
58
|
+
* @param {Function} fn The listener function.
|
|
59
|
+
* @param {*} context The context to invoke the listener with.
|
|
60
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
61
|
+
* @returns {EventEmitter}
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
function addListener(emitter, event, fn, context, once) {
|
|
65
|
+
if (typeof fn !== 'function') {
|
|
66
|
+
throw new TypeError('The listener must be a function');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var listener = new EE(fn, context || emitter, once)
|
|
70
|
+
, evt = prefix ? prefix + event : event;
|
|
71
|
+
|
|
72
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
73
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
74
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
75
|
+
|
|
76
|
+
return emitter;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Clear event by name.
|
|
81
|
+
*
|
|
82
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
83
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
function clearEvent(emitter, evt) {
|
|
87
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
88
|
+
else delete emitter._events[evt];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
93
|
+
* `EventEmitter` interface.
|
|
94
|
+
*
|
|
95
|
+
* @constructor
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
function EventEmitter() {
|
|
99
|
+
this._events = new Events();
|
|
100
|
+
this._eventsCount = 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Return an array listing the events for which the emitter has registered
|
|
105
|
+
* listeners.
|
|
106
|
+
*
|
|
107
|
+
* @returns {Array}
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
111
|
+
var names = []
|
|
112
|
+
, events
|
|
113
|
+
, name;
|
|
114
|
+
|
|
115
|
+
if (this._eventsCount === 0) return names;
|
|
116
|
+
|
|
117
|
+
for (name in (events = this._events)) {
|
|
118
|
+
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (Object.getOwnPropertySymbols) {
|
|
122
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return names;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Return the listeners registered for a given event.
|
|
130
|
+
*
|
|
131
|
+
* @param {(String|Symbol)} event The event name.
|
|
132
|
+
* @returns {Array} The registered listeners.
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
136
|
+
var evt = prefix ? prefix + event : event
|
|
137
|
+
, handlers = this._events[evt];
|
|
138
|
+
|
|
139
|
+
if (!handlers) return [];
|
|
140
|
+
if (handlers.fn) return [handlers.fn];
|
|
141
|
+
|
|
142
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
143
|
+
ee[i] = handlers[i].fn;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return ee;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Return the number of listeners listening to a given event.
|
|
151
|
+
*
|
|
152
|
+
* @param {(String|Symbol)} event The event name.
|
|
153
|
+
* @returns {Number} The number of listeners.
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
157
|
+
var evt = prefix ? prefix + event : event
|
|
158
|
+
, listeners = this._events[evt];
|
|
159
|
+
|
|
160
|
+
if (!listeners) return 0;
|
|
161
|
+
if (listeners.fn) return 1;
|
|
162
|
+
return listeners.length;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Calls each of the listeners registered for a given event.
|
|
167
|
+
*
|
|
168
|
+
* @param {(String|Symbol)} event The event name.
|
|
169
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
173
|
+
var evt = prefix ? prefix + event : event;
|
|
174
|
+
|
|
175
|
+
if (!this._events[evt]) return false;
|
|
176
|
+
|
|
177
|
+
var listeners = this._events[evt]
|
|
178
|
+
, len = arguments.length
|
|
179
|
+
, args
|
|
180
|
+
, i;
|
|
181
|
+
|
|
182
|
+
if (listeners.fn) {
|
|
183
|
+
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
|
184
|
+
|
|
185
|
+
switch (len) {
|
|
186
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
187
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
188
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
189
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
190
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
191
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
for (i = 1, args = new Array(len -1); i < len; i++) {
|
|
195
|
+
args[i - 1] = arguments[i];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
listeners.fn.apply(listeners.context, args);
|
|
199
|
+
} else {
|
|
200
|
+
var length = listeners.length
|
|
201
|
+
, j;
|
|
202
|
+
|
|
203
|
+
for (i = 0; i < length; i++) {
|
|
204
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
|
205
|
+
|
|
206
|
+
switch (len) {
|
|
207
|
+
case 1: listeners[i].fn.call(listeners[i].context); break;
|
|
208
|
+
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
|
|
209
|
+
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
|
|
210
|
+
case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
|
|
211
|
+
default:
|
|
212
|
+
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
|
|
213
|
+
args[j - 1] = arguments[j];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return true;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Add a listener for a given event.
|
|
226
|
+
*
|
|
227
|
+
* @param {(String|Symbol)} event The event name.
|
|
228
|
+
* @param {Function} fn The listener function.
|
|
229
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
230
|
+
* @returns {EventEmitter} `this`.
|
|
231
|
+
* @public
|
|
232
|
+
*/
|
|
233
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
234
|
+
return addListener(this, event, fn, context, false);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Add a one-time listener for a given event.
|
|
239
|
+
*
|
|
240
|
+
* @param {(String|Symbol)} event The event name.
|
|
241
|
+
* @param {Function} fn The listener function.
|
|
242
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
243
|
+
* @returns {EventEmitter} `this`.
|
|
244
|
+
* @public
|
|
245
|
+
*/
|
|
246
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
247
|
+
return addListener(this, event, fn, context, true);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Remove the listeners of a given event.
|
|
252
|
+
*
|
|
253
|
+
* @param {(String|Symbol)} event The event name.
|
|
254
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
255
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
256
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
257
|
+
* @returns {EventEmitter} `this`.
|
|
258
|
+
* @public
|
|
259
|
+
*/
|
|
260
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
261
|
+
var evt = prefix ? prefix + event : event;
|
|
262
|
+
|
|
263
|
+
if (!this._events[evt]) return this;
|
|
264
|
+
if (!fn) {
|
|
265
|
+
clearEvent(this, evt);
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
var listeners = this._events[evt];
|
|
270
|
+
|
|
271
|
+
if (listeners.fn) {
|
|
272
|
+
if (
|
|
273
|
+
listeners.fn === fn &&
|
|
274
|
+
(!once || listeners.once) &&
|
|
275
|
+
(!context || listeners.context === context)
|
|
276
|
+
) {
|
|
277
|
+
clearEvent(this, evt);
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
281
|
+
if (
|
|
282
|
+
listeners[i].fn !== fn ||
|
|
283
|
+
(once && !listeners[i].once) ||
|
|
284
|
+
(context && listeners[i].context !== context)
|
|
285
|
+
) {
|
|
286
|
+
events.push(listeners[i]);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
//
|
|
291
|
+
// Reset the array, or remove it completely if we have no more listeners.
|
|
292
|
+
//
|
|
293
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
294
|
+
else clearEvent(this, evt);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return this;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Remove all listeners, or those of the specified event.
|
|
302
|
+
*
|
|
303
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
304
|
+
* @returns {EventEmitter} `this`.
|
|
305
|
+
* @public
|
|
306
|
+
*/
|
|
307
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
308
|
+
var evt;
|
|
309
|
+
|
|
310
|
+
if (event) {
|
|
311
|
+
evt = prefix ? prefix + event : event;
|
|
312
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
313
|
+
} else {
|
|
314
|
+
this._events = new Events();
|
|
315
|
+
this._eventsCount = 0;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return this;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
//
|
|
322
|
+
// Alias methods names because people roll like that.
|
|
323
|
+
//
|
|
324
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
325
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
326
|
+
|
|
327
|
+
//
|
|
328
|
+
// Expose the prefix.
|
|
329
|
+
//
|
|
330
|
+
EventEmitter.prefixed = prefix;
|
|
331
|
+
|
|
332
|
+
//
|
|
333
|
+
// Allow `EventEmitter` to be imported as module namespace.
|
|
334
|
+
//
|
|
335
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
336
|
+
|
|
337
|
+
//
|
|
338
|
+
// Expose the module.
|
|
339
|
+
//
|
|
340
|
+
{
|
|
341
|
+
module.exports = EventEmitter;
|
|
342
|
+
}
|
|
343
|
+
} (eventemitter3));
|
|
344
|
+
|
|
345
|
+
var eventemitter3Exports = eventemitter3.exports;
|
|
346
|
+
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
347
|
+
|
|
348
|
+
class FactoryMaker {
|
|
349
|
+
static bindInstance(clsName, instance) {
|
|
350
|
+
FactoryMaker.instances.set(clsName, { instance });
|
|
351
|
+
}
|
|
352
|
+
static bindLazyInstance(clsName, builder) {
|
|
353
|
+
FactoryMaker.instances.set(clsName, { builder });
|
|
354
|
+
}
|
|
355
|
+
static bindInstanceIfNotExists(clsName, instance) {
|
|
356
|
+
if (FactoryMaker.instances.has(clsName)) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
FactoryMaker.instances.set(clsName, { instance });
|
|
360
|
+
}
|
|
361
|
+
static getInstance(clsName) {
|
|
362
|
+
var _a;
|
|
363
|
+
const item = FactoryMaker.instances.get(clsName);
|
|
364
|
+
if (item === null || item === undefined) {
|
|
365
|
+
console.warn(`Trying to get a non existing instance for ${clsName}`);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const instance = item.instance ? item.instance : (_a = item.builder) === null || _a === void 0 ? void 0 : _a.call(item);
|
|
369
|
+
return instance;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
FactoryMaker.instances = new Map();
|
|
373
|
+
|
|
374
|
+
function createEventEmitter() {
|
|
375
|
+
const ee = new EventEmitter();
|
|
376
|
+
FactoryMaker.bindInstance('EventEmitter', ee);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
class BaseController {
|
|
380
|
+
get _proxy() {
|
|
381
|
+
return FactoryMaker.getInstance(this.proxyName);
|
|
382
|
+
}
|
|
383
|
+
constructor(proxyName) {
|
|
384
|
+
this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
|
|
385
|
+
this.proxyName = proxyName;
|
|
386
|
+
}
|
|
387
|
+
emit(event, payload) {
|
|
388
|
+
this.eventEmitter.emit(event, payload);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
class BaseNativeProxy {
|
|
392
|
+
constructor() {
|
|
393
|
+
this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function getCoreDefaults() {
|
|
398
|
+
return FactoryMaker.getInstance('CoreDefaults');
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function ignoreFromSerialization(target, propertyName) {
|
|
402
|
+
target.ignoredProperties = target.ignoredProperties || [];
|
|
403
|
+
target.ignoredProperties.push(propertyName);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function nameForSerialization(customName) {
|
|
407
|
+
return (target, propertyName) => {
|
|
408
|
+
target.customPropertyNames = target.customPropertyNames || {};
|
|
409
|
+
target.customPropertyNames[propertyName] = customName;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function ignoreFromSerializationIfNull(target, propertyName) {
|
|
414
|
+
target.ignoredIfNullProperties = target.ignoredIfNullProperties || [];
|
|
415
|
+
target.ignoredIfNullProperties.push(propertyName);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function serializationDefault(defaultValue) {
|
|
419
|
+
return (target, propertyName) => {
|
|
420
|
+
target.customPropertyDefaults = target.customPropertyDefaults || {};
|
|
421
|
+
target.customPropertyDefaults[propertyName] = defaultValue;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
class DefaultSerializeable {
|
|
426
|
+
toJSON() {
|
|
427
|
+
const properties = Object.keys(this);
|
|
428
|
+
// use @ignoreFromSerialization to ignore properties
|
|
429
|
+
const ignoredProperties = this.ignoredProperties || [];
|
|
430
|
+
// use @ignoreFromSerializationIfNull to ignore properties if they're null
|
|
431
|
+
const ignoredIfNullProperties = this.ignoredIfNullProperties || [];
|
|
432
|
+
// use @nameForSerialization('customName') to rename properties in the JSON output
|
|
433
|
+
const customPropertyNames = this.customPropertyNames || {};
|
|
434
|
+
// use @serializationDefault({}) to use a different value in the JSON output if they're null
|
|
435
|
+
const customPropertyDefaults = this.customPropertyDefaults || {};
|
|
436
|
+
return properties.reduce((json, property) => {
|
|
437
|
+
if (ignoredProperties.includes(property)) {
|
|
438
|
+
return json;
|
|
439
|
+
}
|
|
440
|
+
let value = this[property];
|
|
441
|
+
if (value === undefined) {
|
|
442
|
+
return json;
|
|
443
|
+
}
|
|
444
|
+
// Ignore if it's null and should be ignored.
|
|
445
|
+
// This is basically responsible for not including optional properties in the JSON if they're null,
|
|
446
|
+
// as that's not always deserialized to mean the same as not present.
|
|
447
|
+
if (value === null && ignoredIfNullProperties.includes(property)) {
|
|
448
|
+
return json;
|
|
449
|
+
}
|
|
450
|
+
if (value === null && customPropertyDefaults[property] !== undefined) {
|
|
451
|
+
value = customPropertyDefaults[property];
|
|
452
|
+
}
|
|
453
|
+
// Serialize if serializeable
|
|
454
|
+
if (value != null && value.toJSON) {
|
|
455
|
+
value = value.toJSON();
|
|
456
|
+
}
|
|
457
|
+
// Serialize the array if the elements are serializeable
|
|
458
|
+
if (Array.isArray(value)) {
|
|
459
|
+
value = value.map(e => e.toJSON ? e.toJSON() : e);
|
|
460
|
+
}
|
|
461
|
+
const propertyName = customPropertyNames[property] || property;
|
|
462
|
+
json[propertyName] = value;
|
|
463
|
+
return json;
|
|
464
|
+
}, {});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
class TapToFocus extends DefaultSerializeable {
|
|
469
|
+
constructor() {
|
|
470
|
+
super();
|
|
471
|
+
this.type = 'tapToFocus';
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
class PrivateFocusGestureDeserializer {
|
|
476
|
+
static fromJSON(json) {
|
|
477
|
+
if (json && json.type === new TapToFocus().type) {
|
|
478
|
+
return new TapToFocus();
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
class SwipeToZoom extends DefaultSerializeable {
|
|
487
|
+
constructor() {
|
|
488
|
+
super();
|
|
489
|
+
this.type = 'swipeToZoom';
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
class PrivateZoomGestureDeserializer {
|
|
494
|
+
static fromJSON(json) {
|
|
495
|
+
if (json && json.type === new SwipeToZoom().type) {
|
|
496
|
+
return new SwipeToZoom();
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/******************************************************************************
|
|
505
|
+
Copyright (c) Microsoft Corporation.
|
|
506
|
+
|
|
507
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
508
|
+
purpose with or without fee is hereby granted.
|
|
509
|
+
|
|
510
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
511
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
512
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
513
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
514
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
515
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
516
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
517
|
+
***************************************************************************** */
|
|
518
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
function __decorate(decorators, target, key, desc) {
|
|
522
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
523
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
524
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
525
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
529
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
530
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
531
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
532
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
533
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
534
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
539
|
+
var e = new Error(message);
|
|
540
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
var FrameSourceState;
|
|
544
|
+
(function (FrameSourceState) {
|
|
545
|
+
FrameSourceState["On"] = "on";
|
|
546
|
+
FrameSourceState["Off"] = "off";
|
|
547
|
+
FrameSourceState["Starting"] = "starting";
|
|
548
|
+
FrameSourceState["Stopping"] = "stopping";
|
|
549
|
+
FrameSourceState["Standby"] = "standby";
|
|
550
|
+
FrameSourceState["BootingUp"] = "bootingUp";
|
|
551
|
+
FrameSourceState["WakingUp"] = "wakingUp";
|
|
552
|
+
FrameSourceState["GoingToSleep"] = "goingToSleep";
|
|
553
|
+
FrameSourceState["ShuttingDown"] = "shuttingDown";
|
|
554
|
+
})(FrameSourceState || (FrameSourceState = {}));
|
|
555
|
+
|
|
556
|
+
class ImageBuffer {
|
|
557
|
+
get width() {
|
|
558
|
+
return this._width;
|
|
559
|
+
}
|
|
560
|
+
get height() {
|
|
561
|
+
return this._height;
|
|
562
|
+
}
|
|
563
|
+
get data() {
|
|
564
|
+
return this._data;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
class ImageFrameSourceController {
|
|
569
|
+
static forImage(imageFrameSource) {
|
|
570
|
+
const controller = new ImageFrameSourceController();
|
|
571
|
+
controller.imageFrameSource = imageFrameSource;
|
|
572
|
+
return controller;
|
|
573
|
+
}
|
|
574
|
+
constructor() {
|
|
575
|
+
this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
|
|
576
|
+
this._proxy = FactoryMaker.getInstance('ImageFrameSourceProxy');
|
|
577
|
+
}
|
|
578
|
+
getCurrentState() {
|
|
579
|
+
return this._proxy.getCurrentCameraState(this.imageFrameSource.position);
|
|
580
|
+
}
|
|
581
|
+
subscribeListener() {
|
|
582
|
+
this._proxy.registerListenerForEvents();
|
|
583
|
+
this._proxy.subscribeDidChangeState();
|
|
584
|
+
this.eventEmitter.on(FrameSourceListenerEvents.didChangeState, (payload) => {
|
|
585
|
+
const newState = payload.state;
|
|
586
|
+
this.imageFrameSource.listeners.forEach(listener => {
|
|
587
|
+
if (listener.didChangeState) {
|
|
588
|
+
listener.didChangeState(this.imageFrameSource, newState);
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
unsubscribeListener() {
|
|
594
|
+
this._proxy.unregisterListenerForEvents();
|
|
595
|
+
this.eventEmitter.removeAllListeners();
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
class ImageFrameSource extends DefaultSerializeable {
|
|
600
|
+
set context(newContext) {
|
|
601
|
+
if (newContext == null) {
|
|
602
|
+
this.controller.unsubscribeListener();
|
|
603
|
+
}
|
|
604
|
+
else if (this._context == null) {
|
|
605
|
+
this.controller.subscribeListener();
|
|
606
|
+
}
|
|
607
|
+
this._context = newContext;
|
|
608
|
+
}
|
|
609
|
+
get context() {
|
|
610
|
+
return this._context;
|
|
611
|
+
}
|
|
612
|
+
get desiredState() {
|
|
613
|
+
return this._desiredState;
|
|
614
|
+
}
|
|
615
|
+
static create(image) {
|
|
616
|
+
const imageFrameSource = new ImageFrameSource();
|
|
617
|
+
imageFrameSource.image = image;
|
|
618
|
+
return imageFrameSource;
|
|
619
|
+
}
|
|
620
|
+
static fromJSON(json) {
|
|
621
|
+
return ImageFrameSource.create(json.image);
|
|
622
|
+
}
|
|
623
|
+
constructor() {
|
|
624
|
+
super();
|
|
625
|
+
this.type = 'image';
|
|
626
|
+
this.image = '';
|
|
627
|
+
this._id = `${Date.now()}`;
|
|
628
|
+
this._desiredState = FrameSourceState.Off;
|
|
629
|
+
this.listeners = [];
|
|
630
|
+
this._context = null;
|
|
631
|
+
this.controller = ImageFrameSourceController.forImage(this);
|
|
632
|
+
}
|
|
633
|
+
didChange() {
|
|
634
|
+
if (this.context) {
|
|
635
|
+
return this.context.update();
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
return Promise.resolve();
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
switchToDesiredState(state) {
|
|
642
|
+
this._desiredState = state;
|
|
643
|
+
return this.didChange();
|
|
644
|
+
}
|
|
645
|
+
addListener(listener) {
|
|
646
|
+
if (listener == null) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
if (this.listeners.includes(listener)) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
this.listeners.push(listener);
|
|
653
|
+
}
|
|
654
|
+
removeListener(listener) {
|
|
655
|
+
if (listener == null) {
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
if (!this.listeners.includes(listener)) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
662
|
+
}
|
|
663
|
+
getCurrentState() {
|
|
664
|
+
return this.controller.getCurrentState();
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
__decorate([
|
|
668
|
+
nameForSerialization('id')
|
|
669
|
+
], ImageFrameSource.prototype, "_id", void 0);
|
|
670
|
+
__decorate([
|
|
671
|
+
nameForSerialization('desiredState')
|
|
672
|
+
], ImageFrameSource.prototype, "_desiredState", void 0);
|
|
673
|
+
__decorate([
|
|
674
|
+
ignoreFromSerialization
|
|
675
|
+
], ImageFrameSource.prototype, "listeners", void 0);
|
|
676
|
+
__decorate([
|
|
677
|
+
ignoreFromSerialization
|
|
678
|
+
], ImageFrameSource.prototype, "_context", void 0);
|
|
679
|
+
__decorate([
|
|
680
|
+
ignoreFromSerialization
|
|
681
|
+
], ImageFrameSource.prototype, "controller", void 0);
|
|
682
|
+
|
|
683
|
+
class PrivateFrameData {
|
|
684
|
+
get imageBuffers() {
|
|
685
|
+
return this._imageBuffers;
|
|
686
|
+
}
|
|
687
|
+
get orientation() {
|
|
688
|
+
return this._orientation;
|
|
689
|
+
}
|
|
690
|
+
static fromJSON(json) {
|
|
691
|
+
const frameData = new PrivateFrameData();
|
|
692
|
+
frameData._imageBuffers = json.imageBuffers.map((imageBufferJSON) => {
|
|
693
|
+
const imageBuffer = new ImageBuffer();
|
|
694
|
+
imageBuffer._width = imageBufferJSON.width;
|
|
695
|
+
imageBuffer._height = imageBufferJSON.height;
|
|
696
|
+
imageBuffer._data = imageBufferJSON.data;
|
|
697
|
+
return imageBuffer;
|
|
698
|
+
});
|
|
699
|
+
frameData._orientation = json.orientation;
|
|
700
|
+
return frameData;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
var FrameSourceListenerEvents;
|
|
705
|
+
(function (FrameSourceListenerEvents) {
|
|
706
|
+
FrameSourceListenerEvents["didChangeState"] = "FrameSourceListener.onStateChanged";
|
|
707
|
+
})(FrameSourceListenerEvents || (FrameSourceListenerEvents = {}));
|
|
708
|
+
class CameraController {
|
|
709
|
+
static get _proxy() {
|
|
710
|
+
return FactoryMaker.getInstance('CameraProxy');
|
|
711
|
+
}
|
|
712
|
+
static forCamera(camera) {
|
|
713
|
+
const controller = new CameraController();
|
|
714
|
+
controller.camera = camera;
|
|
715
|
+
return controller;
|
|
716
|
+
}
|
|
717
|
+
constructor() {
|
|
718
|
+
this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
|
|
719
|
+
}
|
|
720
|
+
get privateCamera() {
|
|
721
|
+
return this.camera;
|
|
722
|
+
}
|
|
723
|
+
static getLastFrame() {
|
|
724
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
725
|
+
const frameDataJSONString = yield CameraController._proxy.getLastFrame();
|
|
726
|
+
const frameDataJSON = JSON.parse(frameDataJSONString);
|
|
727
|
+
return PrivateFrameData.fromJSON(frameDataJSON);
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
static getLastFrameOrNull() {
|
|
731
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
732
|
+
const frameDataJSONString = yield CameraController._proxy.getLastFrameOrNull();
|
|
733
|
+
if (frameDataJSONString === null || frameDataJSONString === undefined) {
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
const frameDataJSON = JSON.parse(frameDataJSONString);
|
|
737
|
+
return PrivateFrameData.fromJSON(frameDataJSON);
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
getCurrentState() {
|
|
741
|
+
return CameraController._proxy.getCurrentCameraState(this.privateCamera.position);
|
|
742
|
+
}
|
|
743
|
+
getIsTorchAvailable() {
|
|
744
|
+
return CameraController._proxy.isTorchAvailable(this.privateCamera.position);
|
|
745
|
+
}
|
|
746
|
+
subscribeListener() {
|
|
747
|
+
CameraController._proxy.registerListenerForCameraEvents();
|
|
748
|
+
CameraController._proxy.subscribeDidChangeState();
|
|
749
|
+
this.eventEmitter.on(FrameSourceListenerEvents.didChangeState, (state) => {
|
|
750
|
+
this.privateCamera.listeners.forEach(listener => {
|
|
751
|
+
var _a;
|
|
752
|
+
(_a = listener === null || listener === void 0 ? void 0 : listener.didChangeState) === null || _a === void 0 ? void 0 : _a.call(listener, this.camera, state);
|
|
753
|
+
});
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
unsubscribeListener() {
|
|
757
|
+
CameraController._proxy.unregisterListenerForCameraEvents();
|
|
758
|
+
CameraController._proxy.unsubscribeDidChangeState();
|
|
759
|
+
this.eventEmitter.off(FrameSourceListenerEvents.didChangeState);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
var TorchState;
|
|
764
|
+
(function (TorchState) {
|
|
765
|
+
TorchState["On"] = "on";
|
|
766
|
+
TorchState["Off"] = "off";
|
|
767
|
+
TorchState["Auto"] = "auto";
|
|
768
|
+
})(TorchState || (TorchState = {}));
|
|
769
|
+
|
|
770
|
+
class Camera extends DefaultSerializeable {
|
|
771
|
+
static get coreDefaults() {
|
|
772
|
+
return getCoreDefaults();
|
|
773
|
+
}
|
|
774
|
+
set context(newContext) {
|
|
775
|
+
this._context = newContext;
|
|
776
|
+
}
|
|
777
|
+
get context() {
|
|
778
|
+
return this._context;
|
|
779
|
+
}
|
|
780
|
+
static get default() {
|
|
781
|
+
if (Camera.coreDefaults.Camera.defaultPosition) {
|
|
782
|
+
const camera = new Camera();
|
|
783
|
+
camera.position = Camera.coreDefaults.Camera.defaultPosition;
|
|
784
|
+
return camera;
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
return null;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
static atPosition(cameraPosition) {
|
|
791
|
+
if (Camera.coreDefaults.Camera.availablePositions.includes(cameraPosition)) {
|
|
792
|
+
const camera = new Camera();
|
|
793
|
+
camera.position = cameraPosition;
|
|
794
|
+
return camera;
|
|
795
|
+
}
|
|
796
|
+
else {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
get desiredState() {
|
|
801
|
+
return this._desiredState;
|
|
802
|
+
}
|
|
803
|
+
set desiredTorchState(desiredTorchState) {
|
|
804
|
+
this._desiredTorchState = desiredTorchState;
|
|
805
|
+
this.didChange();
|
|
806
|
+
}
|
|
807
|
+
get desiredTorchState() {
|
|
808
|
+
return this._desiredTorchState;
|
|
809
|
+
}
|
|
810
|
+
constructor() {
|
|
811
|
+
super();
|
|
812
|
+
this.type = 'camera';
|
|
813
|
+
this.settings = null;
|
|
814
|
+
this._desiredTorchState = TorchState.Off;
|
|
815
|
+
this._desiredState = FrameSourceState.Off;
|
|
816
|
+
this.listeners = [];
|
|
817
|
+
this._context = null;
|
|
818
|
+
this.controller = CameraController.forCamera(this);
|
|
819
|
+
}
|
|
820
|
+
switchToDesiredState(state) {
|
|
821
|
+
this._desiredState = state;
|
|
822
|
+
return this.didChange();
|
|
823
|
+
}
|
|
824
|
+
getCurrentState() {
|
|
825
|
+
return this.controller.getCurrentState();
|
|
826
|
+
}
|
|
827
|
+
getIsTorchAvailable() {
|
|
828
|
+
return this.controller.getIsTorchAvailable();
|
|
829
|
+
}
|
|
830
|
+
addListener(listener) {
|
|
831
|
+
if (listener == null) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
if (this.listeners.length === 0) {
|
|
835
|
+
this.controller.subscribeListener();
|
|
836
|
+
}
|
|
837
|
+
if (this.listeners.includes(listener)) {
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
this.listeners.push(listener);
|
|
841
|
+
}
|
|
842
|
+
removeListener(listener) {
|
|
843
|
+
if (listener == null) {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
if (!this.listeners.includes(listener)) {
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
850
|
+
if (this.listeners.length === 0) {
|
|
851
|
+
this.controller.unsubscribeListener();
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
applySettings(settings) {
|
|
855
|
+
this.settings = settings;
|
|
856
|
+
return this.didChange();
|
|
857
|
+
}
|
|
858
|
+
didChange() {
|
|
859
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
860
|
+
if (this.context) {
|
|
861
|
+
yield this.context.update();
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
__decorate([
|
|
867
|
+
serializationDefault({})
|
|
868
|
+
], Camera.prototype, "settings", void 0);
|
|
869
|
+
__decorate([
|
|
870
|
+
nameForSerialization('desiredTorchState')
|
|
871
|
+
], Camera.prototype, "_desiredTorchState", void 0);
|
|
872
|
+
__decorate([
|
|
873
|
+
nameForSerialization('desiredState')
|
|
874
|
+
], Camera.prototype, "_desiredState", void 0);
|
|
875
|
+
__decorate([
|
|
876
|
+
ignoreFromSerialization
|
|
877
|
+
], Camera.prototype, "listeners", void 0);
|
|
878
|
+
__decorate([
|
|
879
|
+
ignoreFromSerialization
|
|
880
|
+
], Camera.prototype, "_context", void 0);
|
|
881
|
+
__decorate([
|
|
882
|
+
ignoreFromSerialization
|
|
883
|
+
], Camera.prototype, "controller", void 0);
|
|
884
|
+
__decorate([
|
|
885
|
+
ignoreFromSerialization
|
|
886
|
+
], Camera, "coreDefaults", null);
|
|
887
|
+
|
|
888
|
+
class ZoomSwitchControl extends DefaultSerializeable {
|
|
889
|
+
constructor() {
|
|
890
|
+
super(...arguments);
|
|
891
|
+
this.type = 'zoom';
|
|
892
|
+
this.icon = {
|
|
893
|
+
zoomedOut: { default: null, pressed: null },
|
|
894
|
+
zoomedIn: { default: null, pressed: null },
|
|
895
|
+
};
|
|
896
|
+
this.view = null;
|
|
897
|
+
}
|
|
898
|
+
get zoomedOutImage() {
|
|
899
|
+
return this.icon.zoomedOut.default;
|
|
900
|
+
}
|
|
901
|
+
set zoomedOutImage(zoomedOutImage) {
|
|
902
|
+
var _a;
|
|
903
|
+
this.icon.zoomedOut.default = zoomedOutImage;
|
|
904
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
905
|
+
}
|
|
906
|
+
get zoomedInImage() {
|
|
907
|
+
return this.icon.zoomedIn.default;
|
|
908
|
+
}
|
|
909
|
+
set zoomedInImage(zoomedInImage) {
|
|
910
|
+
var _a;
|
|
911
|
+
this.icon.zoomedIn.default = zoomedInImage;
|
|
912
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
913
|
+
}
|
|
914
|
+
get zoomedInPressedImage() {
|
|
915
|
+
return this.icon.zoomedIn.pressed;
|
|
916
|
+
}
|
|
917
|
+
set zoomedInPressedImage(zoomedInPressedImage) {
|
|
918
|
+
var _a;
|
|
919
|
+
this.icon.zoomedIn.pressed = zoomedInPressedImage;
|
|
920
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
921
|
+
}
|
|
922
|
+
get zoomedOutPressedImage() {
|
|
923
|
+
return this.icon.zoomedOut.pressed;
|
|
924
|
+
}
|
|
925
|
+
set zoomedOutPressedImage(zoomedOutPressedImage) {
|
|
926
|
+
var _a;
|
|
927
|
+
this.icon.zoomedOut.pressed = zoomedOutPressedImage;
|
|
928
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
__decorate([
|
|
932
|
+
ignoreFromSerialization
|
|
933
|
+
], ZoomSwitchControl.prototype, "view", void 0);
|
|
934
|
+
|
|
935
|
+
class TorchSwitchControl extends DefaultSerializeable {
|
|
936
|
+
constructor() {
|
|
937
|
+
super(...arguments);
|
|
938
|
+
this.type = 'torch';
|
|
939
|
+
this.icon = {
|
|
940
|
+
on: { default: null, pressed: null },
|
|
941
|
+
off: { default: null, pressed: null },
|
|
942
|
+
};
|
|
943
|
+
this.view = null;
|
|
944
|
+
}
|
|
945
|
+
get torchOffImage() {
|
|
946
|
+
return this.icon.off.default;
|
|
947
|
+
}
|
|
948
|
+
set torchOffImage(torchOffImage) {
|
|
949
|
+
var _a;
|
|
950
|
+
this.icon.off.default = torchOffImage;
|
|
951
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
952
|
+
}
|
|
953
|
+
get torchOffPressedImage() {
|
|
954
|
+
return this.icon.off.pressed;
|
|
955
|
+
}
|
|
956
|
+
set torchOffPressedImage(torchOffPressedImage) {
|
|
957
|
+
var _a;
|
|
958
|
+
this.icon.off.pressed = torchOffPressedImage;
|
|
959
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
960
|
+
}
|
|
961
|
+
get torchOnImage() {
|
|
962
|
+
return this.icon.on.default;
|
|
963
|
+
}
|
|
964
|
+
set torchOnImage(torchOnImage) {
|
|
965
|
+
var _a;
|
|
966
|
+
this.icon.on.default = torchOnImage;
|
|
967
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
968
|
+
}
|
|
969
|
+
get torchOnPressedImage() {
|
|
970
|
+
return this.icon.on.pressed;
|
|
971
|
+
}
|
|
972
|
+
set torchOnPressedImage(torchOnPressedImage) {
|
|
973
|
+
var _a;
|
|
974
|
+
this.icon.on.pressed = torchOnPressedImage;
|
|
975
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
__decorate([
|
|
979
|
+
ignoreFromSerialization
|
|
980
|
+
], TorchSwitchControl.prototype, "view", void 0);
|
|
981
|
+
|
|
982
|
+
var CameraPosition;
|
|
983
|
+
(function (CameraPosition) {
|
|
984
|
+
CameraPosition["WorldFacing"] = "worldFacing";
|
|
985
|
+
CameraPosition["UserFacing"] = "userFacing";
|
|
986
|
+
CameraPosition["Unspecified"] = "unspecified";
|
|
987
|
+
})(CameraPosition || (CameraPosition = {}));
|
|
988
|
+
|
|
989
|
+
var VideoResolution;
|
|
990
|
+
(function (VideoResolution) {
|
|
991
|
+
VideoResolution["Auto"] = "auto";
|
|
992
|
+
VideoResolution["HD"] = "hd";
|
|
993
|
+
VideoResolution["FullHD"] = "fullHd";
|
|
994
|
+
VideoResolution["UHD4K"] = "uhd4k";
|
|
995
|
+
})(VideoResolution || (VideoResolution = {}));
|
|
996
|
+
|
|
997
|
+
var FocusRange;
|
|
998
|
+
(function (FocusRange) {
|
|
999
|
+
FocusRange["Full"] = "full";
|
|
1000
|
+
FocusRange["Near"] = "near";
|
|
1001
|
+
FocusRange["Far"] = "far";
|
|
1002
|
+
})(FocusRange || (FocusRange = {}));
|
|
1003
|
+
|
|
1004
|
+
var FocusGestureStrategy;
|
|
1005
|
+
(function (FocusGestureStrategy) {
|
|
1006
|
+
FocusGestureStrategy["None"] = "none";
|
|
1007
|
+
FocusGestureStrategy["Manual"] = "manual";
|
|
1008
|
+
FocusGestureStrategy["ManualUntilCapture"] = "manualUntilCapture";
|
|
1009
|
+
FocusGestureStrategy["AutoOnLocation"] = "autoOnLocation";
|
|
1010
|
+
})(FocusGestureStrategy || (FocusGestureStrategy = {}));
|
|
1011
|
+
|
|
1012
|
+
var LogoStyle;
|
|
1013
|
+
(function (LogoStyle) {
|
|
1014
|
+
LogoStyle["Minimal"] = "minimal";
|
|
1015
|
+
LogoStyle["Extended"] = "extended";
|
|
1016
|
+
})(LogoStyle || (LogoStyle = {}));
|
|
1017
|
+
|
|
1018
|
+
class CameraSettings extends DefaultSerializeable {
|
|
1019
|
+
static get coreDefaults() {
|
|
1020
|
+
return getCoreDefaults();
|
|
1021
|
+
}
|
|
1022
|
+
get focusRange() {
|
|
1023
|
+
return this.focus.range;
|
|
1024
|
+
}
|
|
1025
|
+
set focusRange(newRange) {
|
|
1026
|
+
this.focus.range = newRange;
|
|
1027
|
+
}
|
|
1028
|
+
get focusGestureStrategy() {
|
|
1029
|
+
return this.focus.focusGestureStrategy;
|
|
1030
|
+
}
|
|
1031
|
+
set focusGestureStrategy(newStrategy) {
|
|
1032
|
+
this.focus.focusGestureStrategy = newStrategy;
|
|
1033
|
+
}
|
|
1034
|
+
get shouldPreferSmoothAutoFocus() {
|
|
1035
|
+
return this.focus.shouldPreferSmoothAutoFocus;
|
|
1036
|
+
}
|
|
1037
|
+
set shouldPreferSmoothAutoFocus(newShouldPreferSmoothAutoFocus) {
|
|
1038
|
+
this.focus.shouldPreferSmoothAutoFocus = newShouldPreferSmoothAutoFocus;
|
|
1039
|
+
}
|
|
1040
|
+
get maxFrameRate() {
|
|
1041
|
+
// tslint:disable-next-line:no-console
|
|
1042
|
+
console.warn('maxFrameRate is deprecated');
|
|
1043
|
+
return 0;
|
|
1044
|
+
}
|
|
1045
|
+
set maxFrameRate(newValue) {
|
|
1046
|
+
// tslint:disable-next-line:no-console
|
|
1047
|
+
console.warn('maxFrameRate is deprecated');
|
|
1048
|
+
}
|
|
1049
|
+
static fromJSON(json) {
|
|
1050
|
+
const settings = new CameraSettings();
|
|
1051
|
+
settings.preferredResolution = json.preferredResolution;
|
|
1052
|
+
settings.zoomFactor = json.zoomFactor;
|
|
1053
|
+
settings.focusRange = json.focusRange;
|
|
1054
|
+
settings.zoomGestureZoomFactor = json.zoomGestureZoomFactor;
|
|
1055
|
+
settings.focusGestureStrategy = json.focusGestureStrategy;
|
|
1056
|
+
settings.shouldPreferSmoothAutoFocus = json.shouldPreferSmoothAutoFocus;
|
|
1057
|
+
if (json.properties !== undefined) {
|
|
1058
|
+
for (const key of Object.keys(json.properties)) {
|
|
1059
|
+
settings.setProperty(key, json.properties[key]);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
return settings;
|
|
1063
|
+
}
|
|
1064
|
+
constructor(settings) {
|
|
1065
|
+
super();
|
|
1066
|
+
this.focusHiddenProperties = [
|
|
1067
|
+
'range',
|
|
1068
|
+
'manualLensPosition',
|
|
1069
|
+
'shouldPreferSmoothAutoFocus',
|
|
1070
|
+
'focusStrategy',
|
|
1071
|
+
'focusGestureStrategy'
|
|
1072
|
+
];
|
|
1073
|
+
this.preferredResolution = CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
|
|
1074
|
+
this.zoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
|
|
1075
|
+
this.zoomGestureZoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
|
|
1076
|
+
this.focus = {
|
|
1077
|
+
range: CameraSettings.coreDefaults.Camera.Settings.focusRange,
|
|
1078
|
+
focusGestureStrategy: CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
|
|
1079
|
+
shouldPreferSmoothAutoFocus: CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus
|
|
1080
|
+
};
|
|
1081
|
+
this.preferredResolution = CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
|
|
1082
|
+
this.zoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
|
|
1083
|
+
this.zoomGestureZoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
|
|
1084
|
+
this.focus = {
|
|
1085
|
+
range: CameraSettings.coreDefaults.Camera.Settings.focusRange,
|
|
1086
|
+
focusGestureStrategy: CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
|
|
1087
|
+
shouldPreferSmoothAutoFocus: CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
|
|
1088
|
+
};
|
|
1089
|
+
if (settings !== undefined && settings !== null) {
|
|
1090
|
+
Object.getOwnPropertyNames(settings).forEach(propertyName => {
|
|
1091
|
+
this[propertyName] = settings[propertyName];
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
setProperty(name, value) {
|
|
1096
|
+
if (this.focusHiddenProperties.includes(name)) {
|
|
1097
|
+
this.focus[name] = value;
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
this[name] = value;
|
|
1101
|
+
}
|
|
1102
|
+
getProperty(name) {
|
|
1103
|
+
if (this.focusHiddenProperties.includes(name)) {
|
|
1104
|
+
return this.focus[name];
|
|
1105
|
+
}
|
|
1106
|
+
return this[name];
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
__decorate([
|
|
1110
|
+
ignoreFromSerialization
|
|
1111
|
+
], CameraSettings.prototype, "focusHiddenProperties", void 0);
|
|
1112
|
+
|
|
1113
|
+
class Point extends DefaultSerializeable {
|
|
1114
|
+
get x() {
|
|
1115
|
+
return this._x;
|
|
1116
|
+
}
|
|
1117
|
+
get y() {
|
|
1118
|
+
return this._y;
|
|
1119
|
+
}
|
|
1120
|
+
static fromJSON(json) {
|
|
1121
|
+
return new Point(json.x, json.y);
|
|
1122
|
+
}
|
|
1123
|
+
constructor(x, y) {
|
|
1124
|
+
super();
|
|
1125
|
+
this._x = x;
|
|
1126
|
+
this._y = y;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
__decorate([
|
|
1130
|
+
nameForSerialization('x')
|
|
1131
|
+
], Point.prototype, "_x", void 0);
|
|
1132
|
+
__decorate([
|
|
1133
|
+
nameForSerialization('y')
|
|
1134
|
+
], Point.prototype, "_y", void 0);
|
|
1135
|
+
|
|
1136
|
+
class Quadrilateral extends DefaultSerializeable {
|
|
1137
|
+
get topLeft() {
|
|
1138
|
+
return this._topLeft;
|
|
1139
|
+
}
|
|
1140
|
+
get topRight() {
|
|
1141
|
+
return this._topRight;
|
|
1142
|
+
}
|
|
1143
|
+
get bottomRight() {
|
|
1144
|
+
return this._bottomRight;
|
|
1145
|
+
}
|
|
1146
|
+
get bottomLeft() {
|
|
1147
|
+
return this._bottomLeft;
|
|
1148
|
+
}
|
|
1149
|
+
static fromJSON(json) {
|
|
1150
|
+
return new Quadrilateral(Point.fromJSON(json.topLeft), Point.fromJSON(json.topRight), Point.fromJSON(json.bottomRight), Point.fromJSON(json.bottomLeft));
|
|
1151
|
+
}
|
|
1152
|
+
constructor(topLeft, topRight, bottomRight, bottomLeft) {
|
|
1153
|
+
super();
|
|
1154
|
+
this._topLeft = topLeft;
|
|
1155
|
+
this._topRight = topRight;
|
|
1156
|
+
this._bottomRight = bottomRight;
|
|
1157
|
+
this._bottomLeft = bottomLeft;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
__decorate([
|
|
1161
|
+
nameForSerialization('topLeft')
|
|
1162
|
+
], Quadrilateral.prototype, "_topLeft", void 0);
|
|
1163
|
+
__decorate([
|
|
1164
|
+
nameForSerialization('topRight')
|
|
1165
|
+
], Quadrilateral.prototype, "_topRight", void 0);
|
|
1166
|
+
__decorate([
|
|
1167
|
+
nameForSerialization('bottomRight')
|
|
1168
|
+
], Quadrilateral.prototype, "_bottomRight", void 0);
|
|
1169
|
+
__decorate([
|
|
1170
|
+
nameForSerialization('bottomLeft')
|
|
1171
|
+
], Quadrilateral.prototype, "_bottomLeft", void 0);
|
|
1172
|
+
|
|
1173
|
+
class NumberWithUnit extends DefaultSerializeable {
|
|
1174
|
+
get value() {
|
|
1175
|
+
return this._value;
|
|
1176
|
+
}
|
|
1177
|
+
get unit() {
|
|
1178
|
+
return this._unit;
|
|
1179
|
+
}
|
|
1180
|
+
static fromJSON(json) {
|
|
1181
|
+
return new NumberWithUnit(json.value, json.unit);
|
|
1182
|
+
}
|
|
1183
|
+
constructor(value, unit) {
|
|
1184
|
+
super();
|
|
1185
|
+
this._value = value;
|
|
1186
|
+
this._unit = unit;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
__decorate([
|
|
1190
|
+
nameForSerialization('value')
|
|
1191
|
+
], NumberWithUnit.prototype, "_value", void 0);
|
|
1192
|
+
__decorate([
|
|
1193
|
+
nameForSerialization('unit')
|
|
1194
|
+
], NumberWithUnit.prototype, "_unit", void 0);
|
|
1195
|
+
|
|
1196
|
+
var MeasureUnit;
|
|
1197
|
+
(function (MeasureUnit) {
|
|
1198
|
+
MeasureUnit["DIP"] = "dip";
|
|
1199
|
+
MeasureUnit["Pixel"] = "pixel";
|
|
1200
|
+
MeasureUnit["Fraction"] = "fraction";
|
|
1201
|
+
})(MeasureUnit || (MeasureUnit = {}));
|
|
1202
|
+
|
|
1203
|
+
class PointWithUnit extends DefaultSerializeable {
|
|
1204
|
+
get x() {
|
|
1205
|
+
return this._x;
|
|
1206
|
+
}
|
|
1207
|
+
get y() {
|
|
1208
|
+
return this._y;
|
|
1209
|
+
}
|
|
1210
|
+
static fromJSON(json) {
|
|
1211
|
+
return new PointWithUnit(NumberWithUnit.fromJSON(json.x), NumberWithUnit.fromJSON(json.y));
|
|
1212
|
+
}
|
|
1213
|
+
static get zero() {
|
|
1214
|
+
return new PointWithUnit(new NumberWithUnit(0, MeasureUnit.Pixel), new NumberWithUnit(0, MeasureUnit.Pixel));
|
|
1215
|
+
}
|
|
1216
|
+
constructor(x, y) {
|
|
1217
|
+
super();
|
|
1218
|
+
this._x = x;
|
|
1219
|
+
this._y = y;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
__decorate([
|
|
1223
|
+
nameForSerialization('x')
|
|
1224
|
+
], PointWithUnit.prototype, "_x", void 0);
|
|
1225
|
+
__decorate([
|
|
1226
|
+
nameForSerialization('y')
|
|
1227
|
+
], PointWithUnit.prototype, "_y", void 0);
|
|
1228
|
+
|
|
1229
|
+
class Rect extends DefaultSerializeable {
|
|
1230
|
+
get origin() {
|
|
1231
|
+
return this._origin;
|
|
1232
|
+
}
|
|
1233
|
+
get size() {
|
|
1234
|
+
return this._size;
|
|
1235
|
+
}
|
|
1236
|
+
constructor(origin, size) {
|
|
1237
|
+
super();
|
|
1238
|
+
this._origin = origin;
|
|
1239
|
+
this._size = size;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
__decorate([
|
|
1243
|
+
nameForSerialization('origin')
|
|
1244
|
+
], Rect.prototype, "_origin", void 0);
|
|
1245
|
+
__decorate([
|
|
1246
|
+
nameForSerialization('size')
|
|
1247
|
+
], Rect.prototype, "_size", void 0);
|
|
1248
|
+
|
|
1249
|
+
class RectWithUnit extends DefaultSerializeable {
|
|
1250
|
+
get origin() {
|
|
1251
|
+
return this._origin;
|
|
1252
|
+
}
|
|
1253
|
+
get size() {
|
|
1254
|
+
return this._size;
|
|
1255
|
+
}
|
|
1256
|
+
constructor(origin, size) {
|
|
1257
|
+
super();
|
|
1258
|
+
this._origin = origin;
|
|
1259
|
+
this._size = size;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
__decorate([
|
|
1263
|
+
nameForSerialization('origin')
|
|
1264
|
+
], RectWithUnit.prototype, "_origin", void 0);
|
|
1265
|
+
__decorate([
|
|
1266
|
+
nameForSerialization('size')
|
|
1267
|
+
], RectWithUnit.prototype, "_size", void 0);
|
|
1268
|
+
|
|
1269
|
+
class Size extends DefaultSerializeable {
|
|
1270
|
+
get width() {
|
|
1271
|
+
return this._width;
|
|
1272
|
+
}
|
|
1273
|
+
get height() {
|
|
1274
|
+
return this._height;
|
|
1275
|
+
}
|
|
1276
|
+
static fromJSON(json) {
|
|
1277
|
+
return new Size(json.width, json.height);
|
|
1278
|
+
}
|
|
1279
|
+
constructor(width, height) {
|
|
1280
|
+
super();
|
|
1281
|
+
this._width = width;
|
|
1282
|
+
this._height = height;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
__decorate([
|
|
1286
|
+
nameForSerialization('width')
|
|
1287
|
+
], Size.prototype, "_width", void 0);
|
|
1288
|
+
__decorate([
|
|
1289
|
+
nameForSerialization('height')
|
|
1290
|
+
], Size.prototype, "_height", void 0);
|
|
1291
|
+
|
|
1292
|
+
class SizeWithAspect extends DefaultSerializeable {
|
|
1293
|
+
get size() {
|
|
1294
|
+
return this._size;
|
|
1295
|
+
}
|
|
1296
|
+
get aspect() {
|
|
1297
|
+
return this._aspect;
|
|
1298
|
+
}
|
|
1299
|
+
constructor(size, aspect) {
|
|
1300
|
+
super();
|
|
1301
|
+
this._size = size;
|
|
1302
|
+
this._aspect = aspect;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
__decorate([
|
|
1306
|
+
nameForSerialization('size')
|
|
1307
|
+
], SizeWithAspect.prototype, "_size", void 0);
|
|
1308
|
+
__decorate([
|
|
1309
|
+
nameForSerialization('aspect')
|
|
1310
|
+
], SizeWithAspect.prototype, "_aspect", void 0);
|
|
1311
|
+
|
|
1312
|
+
class SizeWithUnit extends DefaultSerializeable {
|
|
1313
|
+
get width() {
|
|
1314
|
+
return this._width;
|
|
1315
|
+
}
|
|
1316
|
+
get height() {
|
|
1317
|
+
return this._height;
|
|
1318
|
+
}
|
|
1319
|
+
constructor(width, height) {
|
|
1320
|
+
super();
|
|
1321
|
+
this._width = width;
|
|
1322
|
+
this._height = height;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
__decorate([
|
|
1326
|
+
nameForSerialization('width')
|
|
1327
|
+
], SizeWithUnit.prototype, "_width", void 0);
|
|
1328
|
+
__decorate([
|
|
1329
|
+
nameForSerialization('height')
|
|
1330
|
+
], SizeWithUnit.prototype, "_height", void 0);
|
|
1331
|
+
|
|
1332
|
+
var SizingMode;
|
|
1333
|
+
(function (SizingMode) {
|
|
1334
|
+
SizingMode["WidthAndHeight"] = "widthAndHeight";
|
|
1335
|
+
SizingMode["WidthAndAspectRatio"] = "widthAndAspectRatio";
|
|
1336
|
+
SizingMode["HeightAndAspectRatio"] = "heightAndAspectRatio";
|
|
1337
|
+
SizingMode["ShorterDimensionAndAspectRatio"] = "shorterDimensionAndAspectRatio";
|
|
1338
|
+
})(SizingMode || (SizingMode = {}));
|
|
1339
|
+
|
|
1340
|
+
class SizeWithUnitAndAspect {
|
|
1341
|
+
constructor() {
|
|
1342
|
+
this._widthAndHeight = null;
|
|
1343
|
+
this._widthAndAspectRatio = null;
|
|
1344
|
+
this._heightAndAspectRatio = null;
|
|
1345
|
+
this._shorterDimensionAndAspectRatio = null;
|
|
1346
|
+
}
|
|
1347
|
+
get widthAndHeight() {
|
|
1348
|
+
return this._widthAndHeight;
|
|
1349
|
+
}
|
|
1350
|
+
get widthAndAspectRatio() {
|
|
1351
|
+
return this._widthAndAspectRatio;
|
|
1352
|
+
}
|
|
1353
|
+
get heightAndAspectRatio() {
|
|
1354
|
+
return this._heightAndAspectRatio;
|
|
1355
|
+
}
|
|
1356
|
+
get shorterDimensionAndAspectRatio() {
|
|
1357
|
+
return this._shorterDimensionAndAspectRatio;
|
|
1358
|
+
}
|
|
1359
|
+
get sizingMode() {
|
|
1360
|
+
if (this.widthAndAspectRatio) {
|
|
1361
|
+
return SizingMode.WidthAndAspectRatio;
|
|
1362
|
+
}
|
|
1363
|
+
if (this.heightAndAspectRatio) {
|
|
1364
|
+
return SizingMode.HeightAndAspectRatio;
|
|
1365
|
+
}
|
|
1366
|
+
if (this.shorterDimensionAndAspectRatio) {
|
|
1367
|
+
return SizingMode.ShorterDimensionAndAspectRatio;
|
|
1368
|
+
}
|
|
1369
|
+
return SizingMode.WidthAndHeight;
|
|
1370
|
+
}
|
|
1371
|
+
static sizeWithWidthAndHeight(widthAndHeight) {
|
|
1372
|
+
const sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
|
|
1373
|
+
sizeWithUnitAndAspect._widthAndHeight = widthAndHeight;
|
|
1374
|
+
return sizeWithUnitAndAspect;
|
|
1375
|
+
}
|
|
1376
|
+
static sizeWithWidthAndAspectRatio(width, aspectRatio) {
|
|
1377
|
+
const sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
|
|
1378
|
+
sizeWithUnitAndAspect._widthAndAspectRatio = new SizeWithAspect(width, aspectRatio);
|
|
1379
|
+
return sizeWithUnitAndAspect;
|
|
1380
|
+
}
|
|
1381
|
+
static sizeWithHeightAndAspectRatio(height, aspectRatio) {
|
|
1382
|
+
const sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
|
|
1383
|
+
sizeWithUnitAndAspect._heightAndAspectRatio = new SizeWithAspect(height, aspectRatio);
|
|
1384
|
+
return sizeWithUnitAndAspect;
|
|
1385
|
+
}
|
|
1386
|
+
static sizeWithShorterDimensionAndAspectRatio(shorterDimension, aspectRatio) {
|
|
1387
|
+
const sizeWithUnitAndAspect = new SizeWithUnitAndAspect();
|
|
1388
|
+
sizeWithUnitAndAspect._shorterDimensionAndAspectRatio = new SizeWithAspect(shorterDimension, aspectRatio);
|
|
1389
|
+
return sizeWithUnitAndAspect;
|
|
1390
|
+
}
|
|
1391
|
+
static fromJSON(json) {
|
|
1392
|
+
if (json.width && json.height) {
|
|
1393
|
+
return this.sizeWithWidthAndHeight(new SizeWithUnit(NumberWithUnit.fromJSON(json.width), NumberWithUnit.fromJSON(json.height)));
|
|
1394
|
+
}
|
|
1395
|
+
else if (json.width && json.aspect) {
|
|
1396
|
+
return this.sizeWithWidthAndAspectRatio(NumberWithUnit.fromJSON(json.width), json.aspect);
|
|
1397
|
+
}
|
|
1398
|
+
else if (json.height && json.aspect) {
|
|
1399
|
+
return this.sizeWithHeightAndAspectRatio(NumberWithUnit.fromJSON(json.height), json.aspect);
|
|
1400
|
+
}
|
|
1401
|
+
else if (json.shorterDimension && json.aspect) {
|
|
1402
|
+
return this.sizeWithShorterDimensionAndAspectRatio(NumberWithUnit.fromJSON(json.shorterDimension), json.aspect);
|
|
1403
|
+
}
|
|
1404
|
+
else {
|
|
1405
|
+
throw new Error(`SizeWithUnitAndAspectJSON is malformed: ${JSON.stringify(json)}`);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
toJSON() {
|
|
1409
|
+
switch (this.sizingMode) {
|
|
1410
|
+
case SizingMode.WidthAndAspectRatio:
|
|
1411
|
+
return {
|
|
1412
|
+
width: this.widthAndAspectRatio.size.toJSON(),
|
|
1413
|
+
aspect: this.widthAndAspectRatio.aspect,
|
|
1414
|
+
};
|
|
1415
|
+
case SizingMode.HeightAndAspectRatio:
|
|
1416
|
+
return {
|
|
1417
|
+
height: this.heightAndAspectRatio.size.toJSON(),
|
|
1418
|
+
aspect: this.heightAndAspectRatio.aspect,
|
|
1419
|
+
};
|
|
1420
|
+
case SizingMode.ShorterDimensionAndAspectRatio:
|
|
1421
|
+
return {
|
|
1422
|
+
shorterDimension: this.shorterDimensionAndAspectRatio.size.toJSON(),
|
|
1423
|
+
aspect: this.shorterDimensionAndAspectRatio.aspect,
|
|
1424
|
+
};
|
|
1425
|
+
default:
|
|
1426
|
+
return {
|
|
1427
|
+
width: this.widthAndHeight.width.toJSON(),
|
|
1428
|
+
height: this.widthAndHeight.height.toJSON(),
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
__decorate([
|
|
1434
|
+
nameForSerialization('widthAndHeight')
|
|
1435
|
+
], SizeWithUnitAndAspect.prototype, "_widthAndHeight", void 0);
|
|
1436
|
+
__decorate([
|
|
1437
|
+
nameForSerialization('widthAndAspectRatio')
|
|
1438
|
+
], SizeWithUnitAndAspect.prototype, "_widthAndAspectRatio", void 0);
|
|
1439
|
+
__decorate([
|
|
1440
|
+
nameForSerialization('heightAndAspectRatio')
|
|
1441
|
+
], SizeWithUnitAndAspect.prototype, "_heightAndAspectRatio", void 0);
|
|
1442
|
+
__decorate([
|
|
1443
|
+
nameForSerialization('shorterDimensionAndAspectRatio')
|
|
1444
|
+
], SizeWithUnitAndAspect.prototype, "_shorterDimensionAndAspectRatio", void 0);
|
|
1445
|
+
|
|
1446
|
+
class MarginsWithUnit extends DefaultSerializeable {
|
|
1447
|
+
get left() {
|
|
1448
|
+
return this._left;
|
|
1449
|
+
}
|
|
1450
|
+
get right() {
|
|
1451
|
+
return this._right;
|
|
1452
|
+
}
|
|
1453
|
+
get top() {
|
|
1454
|
+
return this._top;
|
|
1455
|
+
}
|
|
1456
|
+
get bottom() {
|
|
1457
|
+
return this._bottom;
|
|
1458
|
+
}
|
|
1459
|
+
static fromJSON(json) {
|
|
1460
|
+
return new MarginsWithUnit(NumberWithUnit.fromJSON(json.left), NumberWithUnit.fromJSON(json.right), NumberWithUnit.fromJSON(json.top), NumberWithUnit.fromJSON(json.bottom));
|
|
1461
|
+
}
|
|
1462
|
+
static get zero() {
|
|
1463
|
+
return new MarginsWithUnit(new NumberWithUnit(0, MeasureUnit.Pixel), new NumberWithUnit(0, MeasureUnit.Pixel), new NumberWithUnit(0, MeasureUnit.Pixel), new NumberWithUnit(0, MeasureUnit.Pixel));
|
|
1464
|
+
}
|
|
1465
|
+
constructor(left, right, top, bottom) {
|
|
1466
|
+
super();
|
|
1467
|
+
this._left = left;
|
|
1468
|
+
this._right = right;
|
|
1469
|
+
this._top = top;
|
|
1470
|
+
this._bottom = bottom;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
__decorate([
|
|
1474
|
+
nameForSerialization('left')
|
|
1475
|
+
], MarginsWithUnit.prototype, "_left", void 0);
|
|
1476
|
+
__decorate([
|
|
1477
|
+
nameForSerialization('right')
|
|
1478
|
+
], MarginsWithUnit.prototype, "_right", void 0);
|
|
1479
|
+
__decorate([
|
|
1480
|
+
nameForSerialization('top')
|
|
1481
|
+
], MarginsWithUnit.prototype, "_top", void 0);
|
|
1482
|
+
__decorate([
|
|
1483
|
+
nameForSerialization('bottom')
|
|
1484
|
+
], MarginsWithUnit.prototype, "_bottom", void 0);
|
|
1485
|
+
|
|
1486
|
+
class Color {
|
|
1487
|
+
get redComponent() {
|
|
1488
|
+
return this.hexadecimalString.slice(0, 2);
|
|
1489
|
+
}
|
|
1490
|
+
get greenComponent() {
|
|
1491
|
+
return this.hexadecimalString.slice(2, 4);
|
|
1492
|
+
}
|
|
1493
|
+
get blueComponent() {
|
|
1494
|
+
return this.hexadecimalString.slice(4, 6);
|
|
1495
|
+
}
|
|
1496
|
+
get alphaComponent() {
|
|
1497
|
+
return this.hexadecimalString.slice(6, 8);
|
|
1498
|
+
}
|
|
1499
|
+
get red() {
|
|
1500
|
+
return Color.hexToNumber(this.redComponent);
|
|
1501
|
+
}
|
|
1502
|
+
get green() {
|
|
1503
|
+
return Color.hexToNumber(this.greenComponent);
|
|
1504
|
+
}
|
|
1505
|
+
get blue() {
|
|
1506
|
+
return Color.hexToNumber(this.blueComponent);
|
|
1507
|
+
}
|
|
1508
|
+
get alpha() {
|
|
1509
|
+
return Color.hexToNumber(this.alphaComponent);
|
|
1510
|
+
}
|
|
1511
|
+
static fromHex(hex) {
|
|
1512
|
+
return new Color(Color.normalizeHex(hex));
|
|
1513
|
+
}
|
|
1514
|
+
static fromRGBA(red, green, blue, alpha = 1) {
|
|
1515
|
+
const hexString = [red, green, blue, this.normalizeAlpha(alpha)]
|
|
1516
|
+
.reduce((hex, colorComponent) => hex + this.numberToHex(colorComponent), '');
|
|
1517
|
+
return new Color(hexString);
|
|
1518
|
+
}
|
|
1519
|
+
static hexToNumber(hex) {
|
|
1520
|
+
return parseInt(hex, 16);
|
|
1521
|
+
}
|
|
1522
|
+
static fromJSON(json) {
|
|
1523
|
+
return Color.fromHex(json);
|
|
1524
|
+
}
|
|
1525
|
+
static numberToHex(x) {
|
|
1526
|
+
x = Math.round(x);
|
|
1527
|
+
let hex = x.toString(16);
|
|
1528
|
+
if (hex.length === 1) {
|
|
1529
|
+
hex = '0' + hex;
|
|
1530
|
+
}
|
|
1531
|
+
return hex.toUpperCase();
|
|
1532
|
+
}
|
|
1533
|
+
static normalizeHex(hex) {
|
|
1534
|
+
// remove leading #
|
|
1535
|
+
if (hex[0] === '#') {
|
|
1536
|
+
hex = hex.slice(1);
|
|
1537
|
+
}
|
|
1538
|
+
// double digits if single digit
|
|
1539
|
+
if (hex.length < 6) {
|
|
1540
|
+
hex = hex.split('').map(s => s + s).join('');
|
|
1541
|
+
}
|
|
1542
|
+
// add alpha if missing
|
|
1543
|
+
if (hex.length === 6) {
|
|
1544
|
+
hex = hex + 'FF';
|
|
1545
|
+
}
|
|
1546
|
+
return hex.toUpperCase();
|
|
1547
|
+
}
|
|
1548
|
+
static normalizeAlpha(alpha) {
|
|
1549
|
+
if (alpha > 0 && alpha <= 1) {
|
|
1550
|
+
return 255 * alpha;
|
|
1551
|
+
}
|
|
1552
|
+
return alpha;
|
|
1553
|
+
}
|
|
1554
|
+
constructor(hex) {
|
|
1555
|
+
this.hexadecimalString = hex;
|
|
1556
|
+
}
|
|
1557
|
+
withAlpha(alpha) {
|
|
1558
|
+
const newHex = this.hexadecimalString.slice(0, 6) + Color.numberToHex(Color.normalizeAlpha(alpha));
|
|
1559
|
+
return Color.fromHex(newHex);
|
|
1560
|
+
}
|
|
1561
|
+
toJSON() {
|
|
1562
|
+
return this.hexadecimalString;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
class Brush extends DefaultSerializeable {
|
|
1567
|
+
static get transparent() {
|
|
1568
|
+
const transparentBlack = Color.fromRGBA(255, 255, 255, 0);
|
|
1569
|
+
return new Brush(transparentBlack, transparentBlack, 0);
|
|
1570
|
+
}
|
|
1571
|
+
get fillColor() {
|
|
1572
|
+
return this.fill.color;
|
|
1573
|
+
}
|
|
1574
|
+
get strokeColor() {
|
|
1575
|
+
return this.stroke.color;
|
|
1576
|
+
}
|
|
1577
|
+
get strokeWidth() {
|
|
1578
|
+
return this.stroke.width;
|
|
1579
|
+
}
|
|
1580
|
+
get copy() {
|
|
1581
|
+
return new Brush(this.fillColor, this.strokeColor, this.strokeWidth);
|
|
1582
|
+
}
|
|
1583
|
+
constructor(fillColor = Brush.defaults.fillColor, strokeColor = Brush.defaults.strokeColor, strokeWidth = Brush.defaults.strokeWidth) {
|
|
1584
|
+
super();
|
|
1585
|
+
this.fill = { color: fillColor };
|
|
1586
|
+
this.stroke = { color: strokeColor, width: strokeWidth };
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
var Anchor;
|
|
1591
|
+
(function (Anchor) {
|
|
1592
|
+
Anchor["TopLeft"] = "topLeft";
|
|
1593
|
+
Anchor["TopCenter"] = "topCenter";
|
|
1594
|
+
Anchor["TopRight"] = "topRight";
|
|
1595
|
+
Anchor["CenterLeft"] = "centerLeft";
|
|
1596
|
+
Anchor["Center"] = "center";
|
|
1597
|
+
Anchor["CenterRight"] = "centerRight";
|
|
1598
|
+
Anchor["BottomLeft"] = "bottomLeft";
|
|
1599
|
+
Anchor["BottomCenter"] = "bottomCenter";
|
|
1600
|
+
Anchor["BottomRight"] = "bottomRight";
|
|
1601
|
+
})(Anchor || (Anchor = {}));
|
|
1602
|
+
|
|
1603
|
+
var Orientation;
|
|
1604
|
+
(function (Orientation) {
|
|
1605
|
+
Orientation["Unknown"] = "unknown";
|
|
1606
|
+
Orientation["Portrait"] = "portrait";
|
|
1607
|
+
Orientation["PortraitUpsideDown"] = "portraitUpsideDown";
|
|
1608
|
+
Orientation["LandscapeRight"] = "landscapeRight";
|
|
1609
|
+
Orientation["LandscapeLeft"] = "landscapeLeft";
|
|
1610
|
+
})(Orientation || (Orientation = {}));
|
|
1611
|
+
|
|
1612
|
+
var Direction;
|
|
1613
|
+
(function (Direction) {
|
|
1614
|
+
Direction["None"] = "none";
|
|
1615
|
+
Direction["Horizontal"] = "horizontal";
|
|
1616
|
+
Direction["LeftToRight"] = "leftToRight";
|
|
1617
|
+
Direction["RightToLeft"] = "rightToLeft";
|
|
1618
|
+
Direction["Vertical"] = "vertical";
|
|
1619
|
+
Direction["TopToBottom"] = "topToBottom";
|
|
1620
|
+
Direction["BottomToTop"] = "bottomToTop";
|
|
1621
|
+
})(Direction || (Direction = {}));
|
|
1622
|
+
|
|
1623
|
+
const NoViewfinder = { type: 'none' };
|
|
1624
|
+
|
|
1625
|
+
class RectangularViewfinderAnimation extends DefaultSerializeable {
|
|
1626
|
+
static fromJSON(json) {
|
|
1627
|
+
if (json === null) {
|
|
1628
|
+
return null;
|
|
1629
|
+
}
|
|
1630
|
+
return new RectangularViewfinderAnimation(json.looping);
|
|
1631
|
+
}
|
|
1632
|
+
get isLooping() {
|
|
1633
|
+
return this._isLooping;
|
|
1634
|
+
}
|
|
1635
|
+
constructor(isLooping) {
|
|
1636
|
+
super();
|
|
1637
|
+
this._isLooping = false;
|
|
1638
|
+
this._isLooping = isLooping;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
__decorate([
|
|
1642
|
+
nameForSerialization('isLooping')
|
|
1643
|
+
], RectangularViewfinderAnimation.prototype, "_isLooping", void 0);
|
|
1644
|
+
|
|
1645
|
+
class SpotlightViewfinder extends DefaultSerializeable {
|
|
1646
|
+
get sizeWithUnitAndAspect() {
|
|
1647
|
+
return this._sizeWithUnitAndAspect;
|
|
1648
|
+
}
|
|
1649
|
+
get coreDefaults() {
|
|
1650
|
+
return getCoreDefaults();
|
|
1651
|
+
}
|
|
1652
|
+
constructor() {
|
|
1653
|
+
super();
|
|
1654
|
+
this.type = 'spotlight';
|
|
1655
|
+
console.warn('SpotlightViewfinder is deprecated and will be removed in a future release. Use RectangularViewfinder instead.');
|
|
1656
|
+
this._sizeWithUnitAndAspect = this.coreDefaults.SpotlightViewfinder.size;
|
|
1657
|
+
this.enabledBorderColor = this.coreDefaults.SpotlightViewfinder.enabledBorderColor;
|
|
1658
|
+
this.disabledBorderColor = this.coreDefaults.SpotlightViewfinder.disabledBorderColor;
|
|
1659
|
+
this.backgroundColor = this.coreDefaults.SpotlightViewfinder.backgroundColor;
|
|
1660
|
+
}
|
|
1661
|
+
setSize(size) {
|
|
1662
|
+
this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndHeight(size);
|
|
1663
|
+
}
|
|
1664
|
+
setWidthAndAspectRatio(width, heightToWidthAspectRatio) {
|
|
1665
|
+
this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndAspectRatio(width, heightToWidthAspectRatio);
|
|
1666
|
+
}
|
|
1667
|
+
setHeightAndAspectRatio(height, widthToHeightAspectRatio) {
|
|
1668
|
+
this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithHeightAndAspectRatio(height, widthToHeightAspectRatio);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
__decorate([
|
|
1672
|
+
nameForSerialization('size')
|
|
1673
|
+
], SpotlightViewfinder.prototype, "_sizeWithUnitAndAspect", void 0);
|
|
1674
|
+
|
|
1675
|
+
class LaserlineViewfinder extends DefaultSerializeable {
|
|
1676
|
+
get coreDefaults() {
|
|
1677
|
+
return getCoreDefaults();
|
|
1678
|
+
}
|
|
1679
|
+
constructor(style) {
|
|
1680
|
+
super();
|
|
1681
|
+
this.type = 'laserline';
|
|
1682
|
+
const viewfinderStyle = style || this.coreDefaults.LaserlineViewfinder.defaultStyle;
|
|
1683
|
+
this._style = this.coreDefaults.LaserlineViewfinder.styles[viewfinderStyle].style;
|
|
1684
|
+
this.width = this.coreDefaults.LaserlineViewfinder.styles[viewfinderStyle].width;
|
|
1685
|
+
this.enabledColor = this.coreDefaults.LaserlineViewfinder.styles[viewfinderStyle].enabledColor;
|
|
1686
|
+
this.disabledColor = this.coreDefaults.LaserlineViewfinder.styles[viewfinderStyle].disabledColor;
|
|
1687
|
+
}
|
|
1688
|
+
get style() {
|
|
1689
|
+
return this._style;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
__decorate([
|
|
1693
|
+
nameForSerialization('style')
|
|
1694
|
+
], LaserlineViewfinder.prototype, "_style", void 0);
|
|
1695
|
+
|
|
1696
|
+
var LaserlineViewfinderStyle;
|
|
1697
|
+
(function (LaserlineViewfinderStyle) {
|
|
1698
|
+
LaserlineViewfinderStyle["Legacy"] = "legacy";
|
|
1699
|
+
LaserlineViewfinderStyle["Animated"] = "animated";
|
|
1700
|
+
})(LaserlineViewfinderStyle || (LaserlineViewfinderStyle = {}));
|
|
1701
|
+
|
|
1702
|
+
class RectangularViewfinder extends DefaultSerializeable {
|
|
1703
|
+
get sizeWithUnitAndAspect() {
|
|
1704
|
+
return this._sizeWithUnitAndAspect;
|
|
1705
|
+
}
|
|
1706
|
+
get coreDefaults() {
|
|
1707
|
+
return getCoreDefaults();
|
|
1708
|
+
}
|
|
1709
|
+
constructor(style, lineStyle) {
|
|
1710
|
+
super();
|
|
1711
|
+
this.type = 'rectangular';
|
|
1712
|
+
const viewfinderStyle = style || this.coreDefaults.RectangularViewfinder.defaultStyle;
|
|
1713
|
+
this._style = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].style;
|
|
1714
|
+
this._lineStyle = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].lineStyle;
|
|
1715
|
+
this._dimming = parseFloat(this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].dimming);
|
|
1716
|
+
this._disabledDimming =
|
|
1717
|
+
parseFloat(this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].disabledDimming);
|
|
1718
|
+
this._animation = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].animation;
|
|
1719
|
+
this.color = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].color;
|
|
1720
|
+
this._sizeWithUnitAndAspect = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].size;
|
|
1721
|
+
this._disabledColor = this.coreDefaults.RectangularViewfinder.styles[viewfinderStyle].disabledColor;
|
|
1722
|
+
if (lineStyle !== undefined) {
|
|
1723
|
+
this._lineStyle = lineStyle;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
get style() {
|
|
1727
|
+
return this._style;
|
|
1728
|
+
}
|
|
1729
|
+
get lineStyle() {
|
|
1730
|
+
return this._lineStyle;
|
|
1731
|
+
}
|
|
1732
|
+
get dimming() {
|
|
1733
|
+
return this._dimming;
|
|
1734
|
+
}
|
|
1735
|
+
set dimming(value) {
|
|
1736
|
+
this._dimming = value;
|
|
1737
|
+
}
|
|
1738
|
+
get disabledDimming() {
|
|
1739
|
+
return this._disabledDimming;
|
|
1740
|
+
}
|
|
1741
|
+
set disabledDimming(value) {
|
|
1742
|
+
this._disabledDimming = value;
|
|
1743
|
+
}
|
|
1744
|
+
get animation() {
|
|
1745
|
+
return this._animation;
|
|
1746
|
+
}
|
|
1747
|
+
set animation(animation) {
|
|
1748
|
+
this._animation = animation;
|
|
1749
|
+
}
|
|
1750
|
+
setSize(size) {
|
|
1751
|
+
this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndHeight(size);
|
|
1752
|
+
}
|
|
1753
|
+
setWidthAndAspectRatio(width, heightToWidthAspectRatio) {
|
|
1754
|
+
this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndAspectRatio(width, heightToWidthAspectRatio);
|
|
1755
|
+
}
|
|
1756
|
+
setHeightAndAspectRatio(height, widthToHeightAspectRatio) {
|
|
1757
|
+
this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithHeightAndAspectRatio(height, widthToHeightAspectRatio);
|
|
1758
|
+
}
|
|
1759
|
+
setShorterDimensionAndAspectRatio(fraction, aspectRatio) {
|
|
1760
|
+
this._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithShorterDimensionAndAspectRatio(new NumberWithUnit(fraction, MeasureUnit.Fraction), aspectRatio);
|
|
1761
|
+
}
|
|
1762
|
+
get disabledColor() {
|
|
1763
|
+
return this._disabledColor;
|
|
1764
|
+
}
|
|
1765
|
+
set disabledColor(value) {
|
|
1766
|
+
this._disabledColor = value;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
__decorate([
|
|
1770
|
+
nameForSerialization('style')
|
|
1771
|
+
], RectangularViewfinder.prototype, "_style", void 0);
|
|
1772
|
+
__decorate([
|
|
1773
|
+
nameForSerialization('lineStyle')
|
|
1774
|
+
], RectangularViewfinder.prototype, "_lineStyle", void 0);
|
|
1775
|
+
__decorate([
|
|
1776
|
+
nameForSerialization('dimming')
|
|
1777
|
+
], RectangularViewfinder.prototype, "_dimming", void 0);
|
|
1778
|
+
__decorate([
|
|
1779
|
+
nameForSerialization('disabledDimming')
|
|
1780
|
+
], RectangularViewfinder.prototype, "_disabledDimming", void 0);
|
|
1781
|
+
__decorate([
|
|
1782
|
+
nameForSerialization('animation'),
|
|
1783
|
+
ignoreFromSerialization
|
|
1784
|
+
], RectangularViewfinder.prototype, "_animation", void 0);
|
|
1785
|
+
__decorate([
|
|
1786
|
+
nameForSerialization('size')
|
|
1787
|
+
], RectangularViewfinder.prototype, "_sizeWithUnitAndAspect", void 0);
|
|
1788
|
+
__decorate([
|
|
1789
|
+
nameForSerialization('disabledColor')
|
|
1790
|
+
], RectangularViewfinder.prototype, "_disabledColor", void 0);
|
|
1791
|
+
|
|
1792
|
+
var RectangularViewfinderStyle;
|
|
1793
|
+
(function (RectangularViewfinderStyle) {
|
|
1794
|
+
RectangularViewfinderStyle["Legacy"] = "legacy";
|
|
1795
|
+
RectangularViewfinderStyle["Rounded"] = "rounded";
|
|
1796
|
+
RectangularViewfinderStyle["Square"] = "square";
|
|
1797
|
+
})(RectangularViewfinderStyle || (RectangularViewfinderStyle = {}));
|
|
1798
|
+
|
|
1799
|
+
var RectangularViewfinderLineStyle;
|
|
1800
|
+
(function (RectangularViewfinderLineStyle) {
|
|
1801
|
+
RectangularViewfinderLineStyle["Light"] = "light";
|
|
1802
|
+
RectangularViewfinderLineStyle["Bold"] = "bold";
|
|
1803
|
+
})(RectangularViewfinderLineStyle || (RectangularViewfinderLineStyle = {}));
|
|
1804
|
+
|
|
1805
|
+
class AimerViewfinder extends DefaultSerializeable {
|
|
1806
|
+
get coreDefaults() {
|
|
1807
|
+
return getCoreDefaults();
|
|
1808
|
+
}
|
|
1809
|
+
constructor() {
|
|
1810
|
+
super();
|
|
1811
|
+
this.type = 'aimer';
|
|
1812
|
+
this.frameColor = this.coreDefaults.AimerViewfinder.frameColor;
|
|
1813
|
+
this.dotColor = this.coreDefaults.AimerViewfinder.dotColor;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
function parseDefaults(jsonDefaults) {
|
|
1818
|
+
const coreDefaults = {
|
|
1819
|
+
Camera: {
|
|
1820
|
+
Settings: {
|
|
1821
|
+
preferredResolution: jsonDefaults.Camera.Settings.preferredResolution,
|
|
1822
|
+
zoomFactor: jsonDefaults.Camera.Settings.zoomFactor,
|
|
1823
|
+
focusRange: jsonDefaults.Camera.Settings.focusRange,
|
|
1824
|
+
zoomGestureZoomFactor: jsonDefaults.Camera.Settings.zoomGestureZoomFactor,
|
|
1825
|
+
focusGestureStrategy: jsonDefaults.Camera.Settings.focusGestureStrategy,
|
|
1826
|
+
shouldPreferSmoothAutoFocus: jsonDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
|
|
1827
|
+
properties: jsonDefaults.Camera.Settings.properties,
|
|
1828
|
+
},
|
|
1829
|
+
defaultPosition: (jsonDefaults.Camera.defaultPosition || null),
|
|
1830
|
+
availablePositions: jsonDefaults.Camera.availablePositions,
|
|
1831
|
+
},
|
|
1832
|
+
DataCaptureView: {
|
|
1833
|
+
scanAreaMargins: MarginsWithUnit
|
|
1834
|
+
.fromJSON(JSON.parse(jsonDefaults.DataCaptureView.scanAreaMargins)),
|
|
1835
|
+
pointOfInterest: PointWithUnit
|
|
1836
|
+
.fromJSON(JSON.parse(jsonDefaults.DataCaptureView.pointOfInterest)),
|
|
1837
|
+
logoAnchor: jsonDefaults.DataCaptureView.logoAnchor,
|
|
1838
|
+
logoOffset: PointWithUnit
|
|
1839
|
+
.fromJSON(JSON.parse(jsonDefaults.DataCaptureView.logoOffset)),
|
|
1840
|
+
focusGesture: PrivateFocusGestureDeserializer
|
|
1841
|
+
.fromJSON(JSON.parse(jsonDefaults.DataCaptureView.focusGesture)),
|
|
1842
|
+
zoomGesture: PrivateZoomGestureDeserializer
|
|
1843
|
+
.fromJSON(JSON.parse(jsonDefaults.DataCaptureView.zoomGesture)),
|
|
1844
|
+
logoStyle: jsonDefaults.DataCaptureView.logoStyle,
|
|
1845
|
+
},
|
|
1846
|
+
LaserlineViewfinder: Object
|
|
1847
|
+
.keys(jsonDefaults.LaserlineViewfinder.styles)
|
|
1848
|
+
.reduce((acc, key) => {
|
|
1849
|
+
const viewfinder = jsonDefaults.LaserlineViewfinder.styles[key];
|
|
1850
|
+
acc.styles[key] = {
|
|
1851
|
+
width: NumberWithUnit
|
|
1852
|
+
.fromJSON(JSON.parse(viewfinder.width)),
|
|
1853
|
+
enabledColor: Color
|
|
1854
|
+
.fromJSON(viewfinder.enabledColor),
|
|
1855
|
+
disabledColor: Color
|
|
1856
|
+
.fromJSON(viewfinder.disabledColor),
|
|
1857
|
+
style: viewfinder.style,
|
|
1858
|
+
};
|
|
1859
|
+
return acc;
|
|
1860
|
+
}, { defaultStyle: jsonDefaults.LaserlineViewfinder.defaultStyle, styles: {} }),
|
|
1861
|
+
RectangularViewfinder: Object
|
|
1862
|
+
.keys(jsonDefaults.RectangularViewfinder.styles)
|
|
1863
|
+
.reduce((acc, key) => {
|
|
1864
|
+
const viewfinder = jsonDefaults.RectangularViewfinder.styles[key];
|
|
1865
|
+
acc.styles[key] = {
|
|
1866
|
+
size: SizeWithUnitAndAspect
|
|
1867
|
+
.fromJSON(JSON.parse(viewfinder.size)),
|
|
1868
|
+
color: Color.fromJSON(viewfinder.color),
|
|
1869
|
+
disabledColor: Color.fromJSON(viewfinder.disabledColor),
|
|
1870
|
+
style: viewfinder.style,
|
|
1871
|
+
lineStyle: viewfinder.lineStyle,
|
|
1872
|
+
dimming: viewfinder.dimming,
|
|
1873
|
+
disabledDimming: viewfinder.disabledDimming,
|
|
1874
|
+
animation: RectangularViewfinderAnimation
|
|
1875
|
+
.fromJSON(JSON.parse(viewfinder.animation)),
|
|
1876
|
+
};
|
|
1877
|
+
return acc;
|
|
1878
|
+
}, { defaultStyle: jsonDefaults.RectangularViewfinder.defaultStyle, styles: {} }),
|
|
1879
|
+
SpotlightViewfinder: {
|
|
1880
|
+
size: SizeWithUnitAndAspect
|
|
1881
|
+
.fromJSON(JSON.parse(jsonDefaults.SpotlightViewfinder.size)),
|
|
1882
|
+
enabledBorderColor: Color
|
|
1883
|
+
.fromJSON(jsonDefaults.SpotlightViewfinder.enabledBorderColor),
|
|
1884
|
+
disabledBorderColor: Color
|
|
1885
|
+
.fromJSON(jsonDefaults.SpotlightViewfinder.disabledBorderColor),
|
|
1886
|
+
backgroundColor: Color
|
|
1887
|
+
.fromJSON(jsonDefaults.SpotlightViewfinder.backgroundColor),
|
|
1888
|
+
},
|
|
1889
|
+
AimerViewfinder: {
|
|
1890
|
+
frameColor: Color.fromJSON(jsonDefaults.AimerViewfinder.frameColor),
|
|
1891
|
+
dotColor: Color.fromJSON(jsonDefaults.AimerViewfinder.dotColor),
|
|
1892
|
+
},
|
|
1893
|
+
Brush: {
|
|
1894
|
+
fillColor: Color
|
|
1895
|
+
.fromJSON(jsonDefaults.Brush.fillColor),
|
|
1896
|
+
strokeColor: Color
|
|
1897
|
+
.fromJSON(jsonDefaults.Brush.strokeColor),
|
|
1898
|
+
strokeWidth: jsonDefaults.Brush.strokeWidth,
|
|
1899
|
+
},
|
|
1900
|
+
deviceID: jsonDefaults.deviceID,
|
|
1901
|
+
};
|
|
1902
|
+
// Inject defaults to avoid a circular dependency between these classes and the defaults
|
|
1903
|
+
Brush.defaults = coreDefaults.Brush;
|
|
1904
|
+
return coreDefaults;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
function loadCoreDefaults(jsonDefaults) {
|
|
1908
|
+
const coreDefaults = parseDefaults(jsonDefaults);
|
|
1909
|
+
FactoryMaker.bindInstanceIfNotExists('CoreDefaults', coreDefaults);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
class ContextStatus {
|
|
1913
|
+
static fromJSON(json) {
|
|
1914
|
+
const status = new ContextStatus();
|
|
1915
|
+
status._code = json.code;
|
|
1916
|
+
status._message = json.message;
|
|
1917
|
+
status._isValid = json.isValid;
|
|
1918
|
+
return status;
|
|
1919
|
+
}
|
|
1920
|
+
get message() {
|
|
1921
|
+
return this._message;
|
|
1922
|
+
}
|
|
1923
|
+
get code() {
|
|
1924
|
+
return this._code;
|
|
1925
|
+
}
|
|
1926
|
+
get isValid() {
|
|
1927
|
+
return this._isValid;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
class DataCaptureContextSettings extends DefaultSerializeable {
|
|
1932
|
+
constructor() {
|
|
1933
|
+
super();
|
|
1934
|
+
}
|
|
1935
|
+
setProperty(name, value) {
|
|
1936
|
+
this[name] = value;
|
|
1937
|
+
}
|
|
1938
|
+
getProperty(name) {
|
|
1939
|
+
return this[name];
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
var DataCaptureContextEvents;
|
|
1944
|
+
(function (DataCaptureContextEvents) {
|
|
1945
|
+
DataCaptureContextEvents["didChangeStatus"] = "didChangeStatus";
|
|
1946
|
+
DataCaptureContextEvents["didStartObservingContext"] = "didStartObservingContext";
|
|
1947
|
+
})(DataCaptureContextEvents || (DataCaptureContextEvents = {}));
|
|
1948
|
+
class DataCaptureContextController {
|
|
1949
|
+
get privateContext() {
|
|
1950
|
+
return this.context;
|
|
1951
|
+
}
|
|
1952
|
+
static forDataCaptureContext(context) {
|
|
1953
|
+
const controller = new DataCaptureContextController();
|
|
1954
|
+
controller.context = context;
|
|
1955
|
+
controller.initialize();
|
|
1956
|
+
return controller;
|
|
1957
|
+
}
|
|
1958
|
+
constructor() {
|
|
1959
|
+
this._proxy = FactoryMaker.getInstance('DataCaptureContextProxy');
|
|
1960
|
+
this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
|
|
1961
|
+
}
|
|
1962
|
+
updateContextFromJSON() {
|
|
1963
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1964
|
+
try {
|
|
1965
|
+
yield this._proxy.updateContextFromJSON(this.context);
|
|
1966
|
+
}
|
|
1967
|
+
catch (error) {
|
|
1968
|
+
this.notifyListenersOfDeserializationError(error);
|
|
1969
|
+
throw error;
|
|
1970
|
+
}
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
dispose() {
|
|
1974
|
+
this.unsubscribeListener();
|
|
1975
|
+
this._proxy.dispose();
|
|
1976
|
+
}
|
|
1977
|
+
unsubscribeListener() {
|
|
1978
|
+
this._proxy.unsubscribeListener();
|
|
1979
|
+
this.eventEmitter.removeListener(DataCaptureContextEvents.didChangeStatus);
|
|
1980
|
+
this.eventEmitter.removeListener(DataCaptureContextEvents.didStartObservingContext);
|
|
1981
|
+
}
|
|
1982
|
+
initialize() {
|
|
1983
|
+
this.subscribeListener();
|
|
1984
|
+
return this.initializeContextFromJSON();
|
|
1985
|
+
}
|
|
1986
|
+
initializeContextFromJSON() {
|
|
1987
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1988
|
+
try {
|
|
1989
|
+
this._proxy.contextFromJSON(this.context);
|
|
1990
|
+
}
|
|
1991
|
+
catch (error) {
|
|
1992
|
+
this.notifyListenersOfDeserializationError(error);
|
|
1993
|
+
throw error;
|
|
1994
|
+
}
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
subscribeListener() {
|
|
1998
|
+
this._proxy.registerListenerForEvents();
|
|
1999
|
+
this._proxy.subscribeDidChangeStatus();
|
|
2000
|
+
this._proxy.subscribeDidStartObservingContext();
|
|
2001
|
+
this.eventEmitter.on(DataCaptureContextEvents.didChangeStatus, (contextStatus) => {
|
|
2002
|
+
this.notifyListenersOfDidChangeStatus(contextStatus);
|
|
2003
|
+
});
|
|
2004
|
+
this.eventEmitter.on(DataCaptureContextEvents.didStartObservingContext, () => {
|
|
2005
|
+
this.privateContext.listeners.forEach(listener => {
|
|
2006
|
+
var _a;
|
|
2007
|
+
(_a = listener.didStartObservingContext) === null || _a === void 0 ? void 0 : _a.call(listener, this.context);
|
|
2008
|
+
});
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
notifyListenersOfDeserializationError(error) {
|
|
2012
|
+
const contextStatus = ContextStatus
|
|
2013
|
+
.fromJSON({
|
|
2014
|
+
message: error,
|
|
2015
|
+
code: -1,
|
|
2016
|
+
isValid: true,
|
|
2017
|
+
});
|
|
2018
|
+
this.notifyListenersOfDidChangeStatus(contextStatus);
|
|
2019
|
+
}
|
|
2020
|
+
notifyListenersOfDidChangeStatus(contextStatus) {
|
|
2021
|
+
this.privateContext.listeners.forEach(listener => {
|
|
2022
|
+
if (listener.didChangeStatus) {
|
|
2023
|
+
listener.didChangeStatus(this.context, contextStatus);
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
class DataCaptureContext extends DefaultSerializeable {
|
|
2030
|
+
static get coreDefaults() {
|
|
2031
|
+
return getCoreDefaults();
|
|
2032
|
+
}
|
|
2033
|
+
get frameSource() {
|
|
2034
|
+
return this._frameSource;
|
|
2035
|
+
}
|
|
2036
|
+
static get deviceID() {
|
|
2037
|
+
return DataCaptureContext.coreDefaults.deviceID;
|
|
2038
|
+
}
|
|
2039
|
+
static forLicenseKey(licenseKey) {
|
|
2040
|
+
return DataCaptureContext.forLicenseKeyWithOptions(licenseKey, null);
|
|
2041
|
+
}
|
|
2042
|
+
static forLicenseKeyWithSettings(licenseKey, settings) {
|
|
2043
|
+
const context = this.forLicenseKey(licenseKey);
|
|
2044
|
+
if (settings !== null) {
|
|
2045
|
+
context.applySettings(settings);
|
|
2046
|
+
}
|
|
2047
|
+
return context;
|
|
2048
|
+
}
|
|
2049
|
+
static forLicenseKeyWithOptions(licenseKey, options) {
|
|
2050
|
+
if (options == null) {
|
|
2051
|
+
options = { deviceName: null };
|
|
2052
|
+
}
|
|
2053
|
+
return new DataCaptureContext(licenseKey, options.deviceName || '');
|
|
2054
|
+
}
|
|
2055
|
+
constructor(licenseKey, deviceName) {
|
|
2056
|
+
super();
|
|
2057
|
+
this.licenseKey = licenseKey;
|
|
2058
|
+
this.deviceName = deviceName;
|
|
2059
|
+
// TODO Needs to be changed
|
|
2060
|
+
this.framework = 'capacitor';
|
|
2061
|
+
this.frameworkVersion = `TODO:CHANGE`;
|
|
2062
|
+
this.settings = new DataCaptureContextSettings();
|
|
2063
|
+
this._frameSource = null;
|
|
2064
|
+
// TODO: Change this
|
|
2065
|
+
// private view: PrivateDataCaptureView | null = null;
|
|
2066
|
+
this.view = null;
|
|
2067
|
+
this.modes = [];
|
|
2068
|
+
this.components = [];
|
|
2069
|
+
this.listeners = [];
|
|
2070
|
+
this.initialize();
|
|
2071
|
+
}
|
|
2072
|
+
setFrameSource(frameSource) {
|
|
2073
|
+
if (this._frameSource) {
|
|
2074
|
+
this._frameSource.context = null;
|
|
2075
|
+
}
|
|
2076
|
+
this._frameSource = frameSource;
|
|
2077
|
+
if (frameSource) {
|
|
2078
|
+
frameSource.context = this;
|
|
2079
|
+
}
|
|
2080
|
+
return this.update();
|
|
2081
|
+
}
|
|
2082
|
+
addListener(listener) {
|
|
2083
|
+
if (this.listeners.includes(listener)) {
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2086
|
+
this.listeners.push(listener);
|
|
2087
|
+
}
|
|
2088
|
+
removeListener(listener) {
|
|
2089
|
+
if (!this.listeners.includes(listener)) {
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
2093
|
+
}
|
|
2094
|
+
addMode(mode) {
|
|
2095
|
+
if (!this.modes.includes(mode)) {
|
|
2096
|
+
this.modes.push(mode);
|
|
2097
|
+
mode._context = this;
|
|
2098
|
+
this.update();
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
removeMode(mode) {
|
|
2102
|
+
if (this.modes.includes(mode)) {
|
|
2103
|
+
this.modes.splice(this.modes.indexOf(mode), 1);
|
|
2104
|
+
mode._context = null;
|
|
2105
|
+
this.update();
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
removeAllModes() {
|
|
2109
|
+
this.modes.forEach(mode => {
|
|
2110
|
+
mode._context = null;
|
|
2111
|
+
});
|
|
2112
|
+
this.modes = [];
|
|
2113
|
+
this.update();
|
|
2114
|
+
}
|
|
2115
|
+
dispose() {
|
|
2116
|
+
var _a;
|
|
2117
|
+
if (!this.controller) {
|
|
2118
|
+
return;
|
|
2119
|
+
}
|
|
2120
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
2121
|
+
this.removeAllModes();
|
|
2122
|
+
this.controller.dispose();
|
|
2123
|
+
}
|
|
2124
|
+
applySettings(settings) {
|
|
2125
|
+
this.settings = settings;
|
|
2126
|
+
return this.update();
|
|
2127
|
+
}
|
|
2128
|
+
// Called when the capture view is shown, that is the earliest point that we need the context deserialized.
|
|
2129
|
+
initialize() {
|
|
2130
|
+
if (this.controller) {
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
this.controller = DataCaptureContextController.forDataCaptureContext(this);
|
|
2134
|
+
}
|
|
2135
|
+
update() {
|
|
2136
|
+
if (!this.controller) {
|
|
2137
|
+
return Promise.resolve();
|
|
2138
|
+
}
|
|
2139
|
+
return this.controller.updateContextFromJSON();
|
|
2140
|
+
}
|
|
2141
|
+
addComponent(component) {
|
|
2142
|
+
if (this.components.includes(component)) {
|
|
2143
|
+
return Promise.resolve();
|
|
2144
|
+
}
|
|
2145
|
+
this.components.push(component);
|
|
2146
|
+
component._context = this;
|
|
2147
|
+
return this.update();
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
__decorate([
|
|
2151
|
+
nameForSerialization('frameSource')
|
|
2152
|
+
], DataCaptureContext.prototype, "_frameSource", void 0);
|
|
2153
|
+
__decorate([
|
|
2154
|
+
ignoreFromSerialization
|
|
2155
|
+
], DataCaptureContext.prototype, "controller", void 0);
|
|
2156
|
+
__decorate([
|
|
2157
|
+
ignoreFromSerialization
|
|
2158
|
+
], DataCaptureContext.prototype, "listeners", void 0);
|
|
2159
|
+
__decorate([
|
|
2160
|
+
ignoreFromSerialization
|
|
2161
|
+
], DataCaptureContext, "coreDefaults", null);
|
|
2162
|
+
|
|
2163
|
+
class Vibration extends DefaultSerializeable {
|
|
2164
|
+
static get defaultVibration() {
|
|
2165
|
+
return new Vibration(VibrationType.default);
|
|
2166
|
+
}
|
|
2167
|
+
static get selectionHapticFeedback() {
|
|
2168
|
+
return new Vibration(VibrationType.selectionHaptic);
|
|
2169
|
+
}
|
|
2170
|
+
static get successHapticFeedback() {
|
|
2171
|
+
return new Vibration(VibrationType.successHaptic);
|
|
2172
|
+
}
|
|
2173
|
+
static fromJSON(json) {
|
|
2174
|
+
if (json.type === 'waveForm') {
|
|
2175
|
+
return new WaveFormVibration(json.timings, json.amplitudes);
|
|
2176
|
+
}
|
|
2177
|
+
return new Vibration(json.type);
|
|
2178
|
+
}
|
|
2179
|
+
constructor(type) {
|
|
2180
|
+
super();
|
|
2181
|
+
this.type = type;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
var VibrationType;
|
|
2185
|
+
(function (VibrationType) {
|
|
2186
|
+
VibrationType["default"] = "default";
|
|
2187
|
+
VibrationType["selectionHaptic"] = "selectionHaptic";
|
|
2188
|
+
VibrationType["successHaptic"] = "successHaptic";
|
|
2189
|
+
VibrationType["waveForm"] = "waveForm";
|
|
2190
|
+
})(VibrationType || (VibrationType = {}));
|
|
2191
|
+
class WaveFormVibration extends Vibration {
|
|
2192
|
+
get timings() {
|
|
2193
|
+
return this._timings;
|
|
2194
|
+
}
|
|
2195
|
+
get amplitudes() {
|
|
2196
|
+
return this._amplitudes;
|
|
2197
|
+
}
|
|
2198
|
+
constructor(timings, amplitudes = null) {
|
|
2199
|
+
super(VibrationType.waveForm);
|
|
2200
|
+
this._timings = timings;
|
|
2201
|
+
this._amplitudes = amplitudes;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
__decorate([
|
|
2205
|
+
nameForSerialization('timings')
|
|
2206
|
+
], WaveFormVibration.prototype, "_timings", void 0);
|
|
2207
|
+
__decorate([
|
|
2208
|
+
ignoreFromSerializationIfNull,
|
|
2209
|
+
nameForSerialization('amplitudes')
|
|
2210
|
+
], WaveFormVibration.prototype, "_amplitudes", void 0);
|
|
2211
|
+
|
|
2212
|
+
class Sound extends DefaultSerializeable {
|
|
2213
|
+
static get defaultSound() {
|
|
2214
|
+
return new Sound(null);
|
|
2215
|
+
}
|
|
2216
|
+
static fromJSON(json) {
|
|
2217
|
+
return new Sound(json.resource);
|
|
2218
|
+
}
|
|
2219
|
+
constructor(resource) {
|
|
2220
|
+
super();
|
|
2221
|
+
this.resource = null;
|
|
2222
|
+
this.resource = resource;
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
__decorate([
|
|
2226
|
+
ignoreFromSerializationIfNull
|
|
2227
|
+
], Sound.prototype, "resource", void 0);
|
|
2228
|
+
|
|
2229
|
+
class FeedbackController {
|
|
2230
|
+
constructor(feedback) {
|
|
2231
|
+
this.feedback = feedback;
|
|
2232
|
+
this._proxy = FactoryMaker.getInstance('FeedbackProxy');
|
|
2233
|
+
}
|
|
2234
|
+
static forFeedback(feedback) {
|
|
2235
|
+
const controller = new FeedbackController(feedback);
|
|
2236
|
+
return controller;
|
|
2237
|
+
}
|
|
2238
|
+
emit() {
|
|
2239
|
+
this._proxy.emitFeedback(this.feedback);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
class Feedback extends DefaultSerializeable {
|
|
2244
|
+
static get defaultFeedback() {
|
|
2245
|
+
return new Feedback(Vibration.defaultVibration, Sound.defaultSound);
|
|
2246
|
+
}
|
|
2247
|
+
get vibration() {
|
|
2248
|
+
return this._vibration;
|
|
2249
|
+
}
|
|
2250
|
+
get sound() {
|
|
2251
|
+
return this._sound;
|
|
2252
|
+
}
|
|
2253
|
+
static fromJSON(json) {
|
|
2254
|
+
return new Feedback((json === null || json === void 0 ? void 0 : json.vibration) ? Vibration.fromJSON(json.vibration) : null, (json === null || json === void 0 ? void 0 : json.sound) ? Sound.fromJSON(json.sound) : null);
|
|
2255
|
+
}
|
|
2256
|
+
constructor(vibration, sound) {
|
|
2257
|
+
super();
|
|
2258
|
+
this._vibration = null;
|
|
2259
|
+
this._sound = null;
|
|
2260
|
+
this._vibration = vibration;
|
|
2261
|
+
this._sound = sound;
|
|
2262
|
+
this.controller = FeedbackController.forFeedback(this);
|
|
2263
|
+
}
|
|
2264
|
+
emit() {
|
|
2265
|
+
this.controller.emit();
|
|
2266
|
+
}
|
|
2267
|
+
toJSON() {
|
|
2268
|
+
return super.toJSON();
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
__decorate([
|
|
2272
|
+
ignoreFromSerializationIfNull,
|
|
2273
|
+
nameForSerialization('vibration')
|
|
2274
|
+
], Feedback.prototype, "_vibration", void 0);
|
|
2275
|
+
__decorate([
|
|
2276
|
+
ignoreFromSerializationIfNull,
|
|
2277
|
+
nameForSerialization('sound')
|
|
2278
|
+
], Feedback.prototype, "_sound", void 0);
|
|
2279
|
+
__decorate([
|
|
2280
|
+
ignoreFromSerialization
|
|
2281
|
+
], Feedback.prototype, "controller", void 0);
|
|
2282
|
+
|
|
2283
|
+
const NoneLocationSelection = { type: 'none' };
|
|
2284
|
+
|
|
2285
|
+
class RadiusLocationSelection extends DefaultSerializeable {
|
|
2286
|
+
get radius() {
|
|
2287
|
+
return this._radius;
|
|
2288
|
+
}
|
|
2289
|
+
static fromJSON(JSON) {
|
|
2290
|
+
const radius = NumberWithUnit.fromJSON(JSON.radius);
|
|
2291
|
+
return new RadiusLocationSelection(radius);
|
|
2292
|
+
}
|
|
2293
|
+
constructor(radius) {
|
|
2294
|
+
super();
|
|
2295
|
+
this.type = 'radius';
|
|
2296
|
+
this._radius = radius;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
__decorate([
|
|
2300
|
+
nameForSerialization('radius')
|
|
2301
|
+
], RadiusLocationSelection.prototype, "_radius", void 0);
|
|
2302
|
+
|
|
2303
|
+
class RectangularLocationSelection extends DefaultSerializeable {
|
|
2304
|
+
constructor() {
|
|
2305
|
+
super(...arguments);
|
|
2306
|
+
this.type = 'rectangular';
|
|
2307
|
+
}
|
|
2308
|
+
get sizeWithUnitAndAspect() {
|
|
2309
|
+
return this._sizeWithUnitAndAspect;
|
|
2310
|
+
}
|
|
2311
|
+
static withSize(size) {
|
|
2312
|
+
const locationSelection = new RectangularLocationSelection();
|
|
2313
|
+
locationSelection._sizeWithUnitAndAspect = SizeWithUnitAndAspect.sizeWithWidthAndHeight(size);
|
|
2314
|
+
return locationSelection;
|
|
2315
|
+
}
|
|
2316
|
+
static withWidthAndAspectRatio(width, heightToWidthAspectRatio) {
|
|
2317
|
+
const locationSelection = new RectangularLocationSelection();
|
|
2318
|
+
locationSelection._sizeWithUnitAndAspect = SizeWithUnitAndAspect
|
|
2319
|
+
.sizeWithWidthAndAspectRatio(width, heightToWidthAspectRatio);
|
|
2320
|
+
return locationSelection;
|
|
2321
|
+
}
|
|
2322
|
+
static withHeightAndAspectRatio(height, widthToHeightAspectRatio) {
|
|
2323
|
+
const locationSelection = new RectangularLocationSelection();
|
|
2324
|
+
locationSelection._sizeWithUnitAndAspect = SizeWithUnitAndAspect
|
|
2325
|
+
.sizeWithHeightAndAspectRatio(height, widthToHeightAspectRatio);
|
|
2326
|
+
return locationSelection;
|
|
2327
|
+
}
|
|
2328
|
+
static fromJSON(rectangularLocationSelectionJSON) {
|
|
2329
|
+
if (rectangularLocationSelectionJSON.aspect.width && rectangularLocationSelectionJSON.aspect.height) {
|
|
2330
|
+
const width = NumberWithUnit
|
|
2331
|
+
.fromJSON(rectangularLocationSelectionJSON.aspect.width);
|
|
2332
|
+
const height = NumberWithUnit
|
|
2333
|
+
.fromJSON(rectangularLocationSelectionJSON.aspect.height);
|
|
2334
|
+
const size = new SizeWithUnit(width, height);
|
|
2335
|
+
return this.withSize(size);
|
|
2336
|
+
}
|
|
2337
|
+
else if (rectangularLocationSelectionJSON.aspect.width && rectangularLocationSelectionJSON.aspect.aspect) {
|
|
2338
|
+
const width = NumberWithUnit
|
|
2339
|
+
.fromJSON(rectangularLocationSelectionJSON.aspect.width);
|
|
2340
|
+
return this.withWidthAndAspectRatio(width, rectangularLocationSelectionJSON.aspect.aspect);
|
|
2341
|
+
}
|
|
2342
|
+
else if (rectangularLocationSelectionJSON.aspect.height && rectangularLocationSelectionJSON.aspect.aspect) {
|
|
2343
|
+
const height = NumberWithUnit
|
|
2344
|
+
.fromJSON(rectangularLocationSelectionJSON.aspect.height);
|
|
2345
|
+
return this.withHeightAndAspectRatio(height, rectangularLocationSelectionJSON.aspect.aspect);
|
|
2346
|
+
}
|
|
2347
|
+
else if (rectangularLocationSelectionJSON.aspect.shorterDimension && rectangularLocationSelectionJSON.aspect.aspect) {
|
|
2348
|
+
const shorterDimension = NumberWithUnit
|
|
2349
|
+
.fromJSON(rectangularLocationSelectionJSON.aspect.shorterDimension);
|
|
2350
|
+
const sizeWithUnitAndAspect = SizeWithUnitAndAspect
|
|
2351
|
+
.sizeWithShorterDimensionAndAspectRatio(shorterDimension, rectangularLocationSelectionJSON.aspect.aspect);
|
|
2352
|
+
const locationSelection = new RectangularLocationSelection();
|
|
2353
|
+
locationSelection._sizeWithUnitAndAspect = sizeWithUnitAndAspect;
|
|
2354
|
+
return locationSelection;
|
|
2355
|
+
}
|
|
2356
|
+
else {
|
|
2357
|
+
throw new Error(`RectangularLocationSelectionJSON is malformed: ${JSON.stringify(rectangularLocationSelectionJSON)}`);
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
__decorate([
|
|
2362
|
+
nameForSerialization('size')
|
|
2363
|
+
], RectangularLocationSelection.prototype, "_sizeWithUnitAndAspect", void 0);
|
|
2364
|
+
|
|
2365
|
+
var DataCaptureViewEvents;
|
|
2366
|
+
(function (DataCaptureViewEvents) {
|
|
2367
|
+
DataCaptureViewEvents["didChangeSize"] = "didChangeSize";
|
|
2368
|
+
})(DataCaptureViewEvents || (DataCaptureViewEvents = {}));
|
|
2369
|
+
class DataCaptureViewController extends BaseController {
|
|
2370
|
+
static forDataCaptureView(view) {
|
|
2371
|
+
const controller = new DataCaptureViewController();
|
|
2372
|
+
controller.view = view;
|
|
2373
|
+
controller.subscribeListener();
|
|
2374
|
+
return controller;
|
|
2375
|
+
}
|
|
2376
|
+
constructor() {
|
|
2377
|
+
super('DataCaptureViewProxy');
|
|
2378
|
+
}
|
|
2379
|
+
viewPointForFramePoint(point) {
|
|
2380
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2381
|
+
const jsonString = yield this._proxy.viewPointForFramePoint(JSON.stringify(point.toJSON()));
|
|
2382
|
+
return Point.fromJSON(JSON.parse(jsonString));
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2385
|
+
viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
|
|
2386
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2387
|
+
const jsonString = yield this._proxy.viewQuadrilateralForFrameQuadrilateral(JSON.stringify(quadrilateral.toJSON()));
|
|
2388
|
+
return Quadrilateral.fromJSON(JSON.parse(jsonString));
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
setPositionAndSize(top, left, width, height, shouldBeUnderWebView) {
|
|
2392
|
+
return this._proxy.setPositionAndSize(top, left, width, height, shouldBeUnderWebView);
|
|
2393
|
+
}
|
|
2394
|
+
show() {
|
|
2395
|
+
return this._proxy.show();
|
|
2396
|
+
}
|
|
2397
|
+
hide() {
|
|
2398
|
+
return this._proxy.hide();
|
|
2399
|
+
}
|
|
2400
|
+
dispose() {
|
|
2401
|
+
this.unsubscribeListener();
|
|
2402
|
+
}
|
|
2403
|
+
subscribeListener() {
|
|
2404
|
+
this._proxy.registerListenerForViewEvents();
|
|
2405
|
+
this._proxy.subscribeDidChangeSize();
|
|
2406
|
+
this.eventEmitter.on(DataCaptureViewEvents.didChangeSize, (payload) => {
|
|
2407
|
+
const payloadJSON = JSON.parse(payload);
|
|
2408
|
+
const size = Size.fromJSON(payloadJSON.size);
|
|
2409
|
+
const orientation = payloadJSON.orientation;
|
|
2410
|
+
this.view.listeners.forEach(listener => {
|
|
2411
|
+
if (listener.didChangeSize) {
|
|
2412
|
+
listener.didChangeSize(this.view.viewComponent, size, orientation);
|
|
2413
|
+
}
|
|
2414
|
+
});
|
|
2415
|
+
});
|
|
2416
|
+
}
|
|
2417
|
+
unsubscribeListener() {
|
|
2418
|
+
this._proxy.unregisterListenerForViewEvents();
|
|
2419
|
+
this.eventEmitter.removeAllListeners();
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
class BaseDataCaptureView extends DefaultSerializeable {
|
|
2424
|
+
get context() {
|
|
2425
|
+
return this._context;
|
|
2426
|
+
}
|
|
2427
|
+
set context(context) {
|
|
2428
|
+
if (!(context instanceof DataCaptureContext || context == null)) {
|
|
2429
|
+
// This should never happen, but let's just be sure
|
|
2430
|
+
throw new Error('The context for a capture view must be a DataCaptureContext');
|
|
2431
|
+
}
|
|
2432
|
+
this._context = context;
|
|
2433
|
+
if (this._context) {
|
|
2434
|
+
this._context.view = this;
|
|
2435
|
+
this._context.update();
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
get coreDefaults() {
|
|
2439
|
+
return getCoreDefaults();
|
|
2440
|
+
}
|
|
2441
|
+
get privateContext() {
|
|
2442
|
+
return this.context;
|
|
2443
|
+
}
|
|
2444
|
+
static forContext(context) {
|
|
2445
|
+
const view = new BaseDataCaptureView();
|
|
2446
|
+
view.context = context;
|
|
2447
|
+
return view;
|
|
2448
|
+
}
|
|
2449
|
+
constructor() {
|
|
2450
|
+
super();
|
|
2451
|
+
this._context = null;
|
|
2452
|
+
this.overlays = [];
|
|
2453
|
+
this.controls = [];
|
|
2454
|
+
this.listeners = [];
|
|
2455
|
+
this.controller = DataCaptureViewController.forDataCaptureView(this);
|
|
2456
|
+
this.scanAreaMargins = this.coreDefaults.DataCaptureView.scanAreaMargins;
|
|
2457
|
+
this.pointOfInterest = this.coreDefaults.DataCaptureView.pointOfInterest;
|
|
2458
|
+
this.logoAnchor = this.coreDefaults.DataCaptureView.logoAnchor;
|
|
2459
|
+
this.logoOffset = this.coreDefaults.DataCaptureView.logoOffset;
|
|
2460
|
+
this.focusGesture = this.coreDefaults.DataCaptureView.focusGesture;
|
|
2461
|
+
this.zoomGesture = this.coreDefaults.DataCaptureView.zoomGesture;
|
|
2462
|
+
this.logoStyle = this.coreDefaults.DataCaptureView.logoStyle;
|
|
2463
|
+
}
|
|
2464
|
+
addOverlay(overlay) {
|
|
2465
|
+
if (this.overlays.includes(overlay)) {
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
overlay.view = this;
|
|
2469
|
+
this.overlays.push(overlay);
|
|
2470
|
+
this.privateContext.update();
|
|
2471
|
+
}
|
|
2472
|
+
removeOverlay(overlay) {
|
|
2473
|
+
if (!this.overlays.includes(overlay)) {
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
overlay.view = null;
|
|
2477
|
+
this.overlays.splice(this.overlays.indexOf(overlay), 1);
|
|
2478
|
+
this.privateContext.update();
|
|
2479
|
+
}
|
|
2480
|
+
addListener(listener) {
|
|
2481
|
+
if (!this.listeners.includes(listener)) {
|
|
2482
|
+
this.listeners.push(listener);
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
removeListener(listener) {
|
|
2486
|
+
if (this.listeners.includes(listener)) {
|
|
2487
|
+
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
viewPointForFramePoint(point) {
|
|
2491
|
+
return this.controller.viewPointForFramePoint(point);
|
|
2492
|
+
}
|
|
2493
|
+
viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
|
|
2494
|
+
return this.controller.viewQuadrilateralForFrameQuadrilateral(quadrilateral);
|
|
2495
|
+
}
|
|
2496
|
+
addControl(control) {
|
|
2497
|
+
if (!this.controls.includes(control)) {
|
|
2498
|
+
control.view = this;
|
|
2499
|
+
this.controls.push(control);
|
|
2500
|
+
this.privateContext.update();
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
removeControl(control) {
|
|
2504
|
+
if (this.controls.includes(control)) {
|
|
2505
|
+
control.view = null;
|
|
2506
|
+
this.controls.splice(this.overlays.indexOf(control), 1);
|
|
2507
|
+
this.privateContext.update();
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
controlUpdated() {
|
|
2511
|
+
this.privateContext.update();
|
|
2512
|
+
}
|
|
2513
|
+
dispose() {
|
|
2514
|
+
this.overlays.forEach(overlay => this.removeOverlay(overlay));
|
|
2515
|
+
this.listeners.forEach(listener => this.removeListener(listener));
|
|
2516
|
+
this.controller.dispose();
|
|
2517
|
+
}
|
|
2518
|
+
// HTML Views only
|
|
2519
|
+
setFrame(frame, isUnderContent = false) {
|
|
2520
|
+
return this.setPositionAndSize(frame.origin.y, frame.origin.x, frame.size.width, frame.size.height, isUnderContent);
|
|
2521
|
+
}
|
|
2522
|
+
setPositionAndSize(top, left, width, height, shouldBeUnderWebView) {
|
|
2523
|
+
return this.controller.setPositionAndSize(top, left, width, height, shouldBeUnderWebView);
|
|
2524
|
+
}
|
|
2525
|
+
show() {
|
|
2526
|
+
if (!this.context) {
|
|
2527
|
+
throw new Error('There should be a context attached to a view that should be shown');
|
|
2528
|
+
}
|
|
2529
|
+
this.privateContext.initialize();
|
|
2530
|
+
return this.controller.show();
|
|
2531
|
+
}
|
|
2532
|
+
hide() {
|
|
2533
|
+
if (!this.context) {
|
|
2534
|
+
throw new Error('There should be a context attached to a view that should be shown');
|
|
2535
|
+
}
|
|
2536
|
+
return this.controller.hide();
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
__decorate([
|
|
2540
|
+
ignoreFromSerialization
|
|
2541
|
+
], BaseDataCaptureView.prototype, "_context", void 0);
|
|
2542
|
+
__decorate([
|
|
2543
|
+
ignoreFromSerialization
|
|
2544
|
+
], BaseDataCaptureView.prototype, "viewComponent", void 0);
|
|
2545
|
+
__decorate([
|
|
2546
|
+
ignoreFromSerialization
|
|
2547
|
+
], BaseDataCaptureView.prototype, "coreDefaults", null);
|
|
2548
|
+
__decorate([
|
|
2549
|
+
ignoreFromSerialization
|
|
2550
|
+
], BaseDataCaptureView.prototype, "controller", void 0);
|
|
2551
|
+
__decorate([
|
|
2552
|
+
ignoreFromSerialization
|
|
2553
|
+
], BaseDataCaptureView.prototype, "listeners", void 0);
|
|
2554
|
+
|
|
2555
|
+
class LicenseInfo extends DefaultSerializeable {
|
|
2556
|
+
get expiration() {
|
|
2557
|
+
return this._expiration;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
__decorate([
|
|
2561
|
+
nameForSerialization('expiration')
|
|
2562
|
+
// @ts-ignore
|
|
2563
|
+
], LicenseInfo.prototype, "_expiration", void 0);
|
|
2564
|
+
|
|
2565
|
+
var Expiration;
|
|
2566
|
+
(function (Expiration) {
|
|
2567
|
+
Expiration["Available"] = "available";
|
|
2568
|
+
Expiration["Perpetual"] = "perpetual";
|
|
2569
|
+
Expiration["NotAvailable"] = "notAvailable";
|
|
2570
|
+
})(Expiration || (Expiration = {}));
|
|
2571
|
+
|
|
2572
|
+
createEventEmitter();
|
|
2573
|
+
|
|
2574
|
+
export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FrameSourceListenerEvents, FrameSourceState, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LaserlineViewfinderStyle, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SpotlightViewfinder, SwipeToZoom, TapToFocus, TorchState, TorchSwitchControl, Vibration, VideoResolution, WaveFormVibration, ZoomSwitchControl, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
|
|
2575
|
+
//# sourceMappingURL=index.js.map
|