scandit-datacapture-frameworks-core 8.3.1 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/Defaults.ts +9 -0
- package/dist/dts/camera/Camera.d.ts +6 -1
- package/dist/dts/camera/CameraSettings.d.ts +3 -0
- package/dist/dts/camera/PinchToZoom.d.ts +20 -0
- package/dist/dts/camera/PrivateZoomGestureDeserializer.d.ts +5 -0
- package/dist/dts/camera/ZoomGesture.d.ts +0 -3
- package/dist/dts/camera/ZoomSwitchControl.d.ts +28 -0
- package/dist/dts/camera/ZoomSwitchOrientation.d.ts +5 -0
- package/dist/dts/camera/controller/CameraController.d.ts +4 -0
- package/dist/dts/camera/index.d.ts +3 -0
- package/dist/dts/camerahelpers/ZoomListenerEvents.d.ts +3 -0
- package/dist/dts/camerahelpers/index.d.ts +1 -0
- package/dist/dts/defaults/CoreDefaults.d.ts +14 -4
- package/dist/dts/frame/ZoomListener.d.ts +3 -0
- package/dist/dts/frame/index.d.ts +1 -0
- package/dist/dts/generated/CoreProxyAdapter.d.ts +17 -0
- package/dist/dts/view/DataCaptureView.d.ts +6 -1
- package/dist/dts/view/DataCaptureViewController.d.ts +1 -0
- package/dist/index.js +379 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/test/CameraSettings.test.ts +44 -0
- package/test/CoreDefaults.test.ts +62 -0
- package/test/ZoomSwitchControl.test.ts +130 -0
package/__mocks__/Defaults.ts
CHANGED
|
@@ -6,6 +6,7 @@ export const mockCoreDefaultsData: any = {
|
|
|
6
6
|
"Settings": {
|
|
7
7
|
"zoomFactor": 1,
|
|
8
8
|
"zoomGestureZoomFactor": 2,
|
|
9
|
+
"zoomLevels": [1, 2],
|
|
9
10
|
"focusGestureStrategy": "manualUntilCapture",
|
|
10
11
|
"focusRange": "near",
|
|
11
12
|
"preferredResolution": "auto",
|
|
@@ -19,6 +20,13 @@ export const mockCoreDefaultsData: any = {
|
|
|
19
20
|
},
|
|
20
21
|
"availablePositions": ["worldFacing", "userFacing"]
|
|
21
22
|
},
|
|
23
|
+
"ZoomSwitchControl": {
|
|
24
|
+
"orientation": "horizontal",
|
|
25
|
+
"isAlwaysExpanded": false,
|
|
26
|
+
"isExpanded": false,
|
|
27
|
+
"accessibilityLabel": "Zoom <level>",
|
|
28
|
+
"accessibilityHint": "Adjusts the camera zoom level"
|
|
29
|
+
},
|
|
22
30
|
"Version": "8.1.0-test",
|
|
23
31
|
"deviceID": "test-device-id",
|
|
24
32
|
"AimerViewfinder": {
|
|
@@ -42,6 +50,7 @@ export const mockCoreDefaultsData: any = {
|
|
|
42
50
|
},
|
|
43
51
|
"DataCaptureView": {
|
|
44
52
|
"zoomGesture": "{\"type\":\"swipeToZoom\"}",
|
|
53
|
+
"zoomGestures": "[{\"type\":\"swipeToZoom\"},{\"type\":\"pinchToZoom\"}]",
|
|
45
54
|
"pointOfInterest": "{\"x\":{\"unit\":\"fraction\",\"value\":0.5},\"y\":{\"unit\":\"fraction\",\"value\":0.5}}",
|
|
46
55
|
"focusGesture": "{\"showUIIndicator\":true,\"type\":\"tapToFocus\"}",
|
|
47
56
|
"logoStyle": "extended",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataCaptureContext } from "../context";
|
|
2
|
-
import { FrameSource, FrameSourceListener, FrameSourceState, TorchListener, MacroModeListener } from "../frame";
|
|
2
|
+
import { FrameSource, FrameSourceListener, FrameSourceState, TorchListener, MacroModeListener, ZoomListener } from "../frame";
|
|
3
3
|
import { DefaultSerializeable } from "../serializable";
|
|
4
4
|
import { CameraController } from "./controller/CameraController";
|
|
5
5
|
import { TorchState } from "./TorchState";
|
|
@@ -38,6 +38,8 @@ export declare class Camera extends DefaultSerializeable implements FrameSource
|
|
|
38
38
|
private listeners;
|
|
39
39
|
private torchListeners;
|
|
40
40
|
private macroModeListeners;
|
|
41
|
+
private zoomListeners;
|
|
42
|
+
private _hasZoomListeners;
|
|
41
43
|
private _context;
|
|
42
44
|
private nativeReadyResolver;
|
|
43
45
|
private nativeReadyRejecter;
|
|
@@ -58,6 +60,8 @@ export declare class Camera extends DefaultSerializeable implements FrameSource
|
|
|
58
60
|
removeTorchListener(listener: TorchListener): void;
|
|
59
61
|
addMacroModeListener(listener: MacroModeListener): void;
|
|
60
62
|
removeMacroModeListener(listener: MacroModeListener): void;
|
|
63
|
+
addZoomListener(listener: ZoomListener): void;
|
|
64
|
+
removeZoomListener(listener: ZoomListener): void;
|
|
61
65
|
applySettings(settings: CameraSettings): Promise<void>;
|
|
62
66
|
private set context(value);
|
|
63
67
|
private get context();
|
|
@@ -83,6 +87,7 @@ export interface PrivateCamera {
|
|
|
83
87
|
listeners: FrameSourceListener[];
|
|
84
88
|
torchListeners: TorchListener[];
|
|
85
89
|
macroModeListeners: MacroModeListener[];
|
|
90
|
+
zoomListeners: ZoomListener[];
|
|
86
91
|
controller: CameraController;
|
|
87
92
|
get isActiveCamera(): boolean;
|
|
88
93
|
initialize: () => void;
|
|
@@ -7,6 +7,7 @@ export interface CameraSettingsJSON {
|
|
|
7
7
|
preferredResolution: string;
|
|
8
8
|
zoomFactor: number;
|
|
9
9
|
zoomGestureZoomFactor: number;
|
|
10
|
+
zoomLevels?: number[];
|
|
10
11
|
macroMode?: string;
|
|
11
12
|
adaptiveExposure?: boolean;
|
|
12
13
|
torchLevel?: number;
|
|
@@ -23,7 +24,9 @@ export interface PrivateCameraSettings {
|
|
|
23
24
|
export declare class CameraSettings extends DefaultSerializeable {
|
|
24
25
|
preferredResolution: VideoResolution;
|
|
25
26
|
zoomFactor: number;
|
|
27
|
+
/** @deprecated Use zoomLevels instead. */
|
|
26
28
|
zoomGestureZoomFactor: number;
|
|
29
|
+
zoomLevels: number[];
|
|
27
30
|
torchLevel: number;
|
|
28
31
|
macroMode: MacroMode;
|
|
29
32
|
adaptiveExposure: boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DefaultSerializeable } from "../serializable";
|
|
2
|
+
import { DataCaptureViewController } from "../view";
|
|
3
|
+
import { ZoomGesture } from "./ZoomGesture";
|
|
4
|
+
import { ZoomGestureListener } from "./ZoomGestureListener";
|
|
5
|
+
export interface PrivatePinchToZoom {
|
|
6
|
+
listeners: ZoomGestureListener[];
|
|
7
|
+
onListenersChanged?(): void;
|
|
8
|
+
_controller?: DataCaptureViewController | null;
|
|
9
|
+
}
|
|
10
|
+
export declare class PinchToZoom extends DefaultSerializeable implements ZoomGesture {
|
|
11
|
+
private type;
|
|
12
|
+
private listeners;
|
|
13
|
+
private onListenersChanged?;
|
|
14
|
+
private _controller?;
|
|
15
|
+
constructor();
|
|
16
|
+
addListener(listener: ZoomGestureListener): void;
|
|
17
|
+
removeListener(listener: ZoomGestureListener): void;
|
|
18
|
+
triggerZoomIn(): Promise<void>;
|
|
19
|
+
triggerZoomOut(): Promise<void>;
|
|
20
|
+
}
|
|
@@ -1,28 +1,56 @@
|
|
|
1
1
|
import { DefaultSerializeable } from "../serializable";
|
|
2
2
|
import { Control } from "../view";
|
|
3
|
+
import { ZoomSwitchOrientation } from "./ZoomSwitchOrientation";
|
|
3
4
|
export declare class ZoomSwitchControl extends DefaultSerializeable implements Control {
|
|
4
5
|
private type;
|
|
5
6
|
private icon;
|
|
6
7
|
private view;
|
|
7
8
|
private anchor;
|
|
8
9
|
private offset;
|
|
10
|
+
private static get coreDefaults();
|
|
11
|
+
/** @deprecated Use the unified `accessibilityLabel` property instead. */
|
|
9
12
|
contentDescriptionWhenZoomedOut: string | null;
|
|
13
|
+
/** @deprecated Use the unified `accessibilityLabel` property instead. */
|
|
10
14
|
contentDescriptionWhenZoomedIn: string | null;
|
|
15
|
+
/** @deprecated Use the unified `accessibilityLabel` property instead. */
|
|
11
16
|
accessibilityLabelWhenZoomedOut: string | null;
|
|
17
|
+
/** @deprecated Use the unified `accessibilityLabel` property instead. */
|
|
12
18
|
accessibilityLabelWhenZoomedIn: string | null;
|
|
19
|
+
/** @deprecated Use the unified `accessibilityHint` property instead. */
|
|
13
20
|
accessibilityHintWhenZoomedOut: string | null;
|
|
21
|
+
/** @deprecated Use the unified `accessibilityHint` property instead. */
|
|
14
22
|
accessibilityHintWhenZoomedIn: string | null;
|
|
23
|
+
orientation: ZoomSwitchOrientation;
|
|
24
|
+
isAlwaysExpanded: boolean;
|
|
25
|
+
isExpanded: boolean;
|
|
26
|
+
accessibilityLabel: string;
|
|
27
|
+
accessibilityHint: string;
|
|
28
|
+
private _selectedZoomLevel;
|
|
29
|
+
get selectedZoomLevel(): number;
|
|
15
30
|
constructor();
|
|
31
|
+
selectZoomLevel(level: number): Promise<number>;
|
|
32
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
16
33
|
get zoomedOutImage(): string | null;
|
|
34
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
17
35
|
set zoomedOutImage(zoomedOutImage: string | null);
|
|
36
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
18
37
|
get zoomedInImage(): string | null;
|
|
38
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
19
39
|
set zoomedInImage(zoomedInImage: string | null);
|
|
40
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
20
41
|
get zoomedInPressedImage(): string | null;
|
|
42
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
21
43
|
set zoomedInPressedImage(zoomedInPressedImage: string | null);
|
|
44
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
22
45
|
get zoomedOutPressedImage(): string | null;
|
|
46
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
23
47
|
set zoomedOutPressedImage(zoomedOutPressedImage: string | null);
|
|
48
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
24
49
|
setZoomedInImage(resource: string): void;
|
|
50
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
25
51
|
setZoomedInPressedImage(resource: string): void;
|
|
52
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
26
53
|
setZoomedOutImage(resource: string): void;
|
|
54
|
+
/** @deprecated Use the new ZoomSwitchControl v2 API. Image-based customization will be removed in 9.0. */
|
|
27
55
|
setZoomedOutPressedImage(resource: string): void;
|
|
28
56
|
}
|
|
@@ -16,6 +16,8 @@ export declare class CameraController extends BaseController<CoreProxy> {
|
|
|
16
16
|
unsubscribeTorchListener(): Promise<void>;
|
|
17
17
|
subscribeMacroModeListener(): Promise<void>;
|
|
18
18
|
unsubscribeMacroModeListener(): Promise<void>;
|
|
19
|
+
subscribeZoomListener(): Promise<void>;
|
|
20
|
+
unsubscribeZoomListener(): Promise<void>;
|
|
19
21
|
dispose(): void;
|
|
20
22
|
private handleDidChangeStateEvent;
|
|
21
23
|
private handleDidChangeStateEventWrapper;
|
|
@@ -23,4 +25,6 @@ export declare class CameraController extends BaseController<CoreProxy> {
|
|
|
23
25
|
private handleDidChangeTorchToStateEventWrapper;
|
|
24
26
|
private handleDidChangeMacroModeEvent;
|
|
25
27
|
private handleDidChangeMacroModeEventWrapper;
|
|
28
|
+
private handleDidChangeZoomLevelEvent;
|
|
29
|
+
private handleDidChangeZoomLevelEventWrapper;
|
|
26
30
|
}
|
|
@@ -4,6 +4,7 @@ export * from "./FocusGestureListenerEvents";
|
|
|
4
4
|
export * from "./TapToFocus";
|
|
5
5
|
export * from "./PrivateFocusGestureDeserializer";
|
|
6
6
|
export * from "./ZoomGesture";
|
|
7
|
+
export * from "./PrivateZoomGestureDeserializer";
|
|
7
8
|
export * from "./ZoomGestureListener";
|
|
8
9
|
export * from "./ZoomGestureListenerEvents";
|
|
9
10
|
export * from "./controller/CameraController";
|
|
@@ -17,5 +18,7 @@ export * from "./FocusRange";
|
|
|
17
18
|
export * from "./FocusGestureStrategy";
|
|
18
19
|
export * from "./LogoStyle";
|
|
19
20
|
export * from "./SwipeToZoom";
|
|
21
|
+
export * from "./PinchToZoom";
|
|
20
22
|
export * from "./CameraSettings";
|
|
21
23
|
export * from "./MacroMode";
|
|
24
|
+
export * from "./ZoomSwitchOrientation";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FocusGesture, FocusGestureStrategy, FocusRange, LogoStyle, MacroMode, VideoResolution, ZoomGesture } from
|
|
2
|
-
import { CameraPosition } from
|
|
3
|
-
import { Anchor, Brush, Color, MarginsWithUnit, NumberWithUnit, PointWithUnit, SizeWithUnitAndAspect } from
|
|
4
|
-
import { RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle } from
|
|
1
|
+
import { FocusGesture, FocusGestureStrategy, FocusRange, LogoStyle, MacroMode, VideoResolution, ZoomGesture, ZoomSwitchOrientation } from '../camera';
|
|
2
|
+
import { CameraPosition } from '../camerahelpers';
|
|
3
|
+
import { Anchor, Brush, Color, MarginsWithUnit, NumberWithUnit, PointWithUnit, SizeWithUnitAndAspect } from '../common';
|
|
4
|
+
import { RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle } from '../viewfinder';
|
|
5
5
|
export interface CameraSettingsDefaults {
|
|
6
6
|
preferredResolution: VideoResolution;
|
|
7
7
|
zoomFactor: number;
|
|
@@ -11,6 +11,7 @@ export interface CameraSettingsDefaults {
|
|
|
11
11
|
shouldPreferSmoothAutoFocus: boolean;
|
|
12
12
|
manualLensPosition: number;
|
|
13
13
|
focusStrategy: string;
|
|
14
|
+
zoomLevels: number[];
|
|
14
15
|
torchLevel: number;
|
|
15
16
|
macroMode: MacroMode;
|
|
16
17
|
adaptiveExposure: boolean;
|
|
@@ -18,12 +19,20 @@ export interface CameraSettingsDefaults {
|
|
|
18
19
|
[key: string]: unknown;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
22
|
+
export interface ZoomSwitchControlDefaults {
|
|
23
|
+
orientation: ZoomSwitchOrientation;
|
|
24
|
+
isAlwaysExpanded: boolean;
|
|
25
|
+
isExpanded: boolean;
|
|
26
|
+
accessibilityLabel: string;
|
|
27
|
+
accessibilityHint: string;
|
|
28
|
+
}
|
|
21
29
|
export interface CoreDefaults {
|
|
22
30
|
Camera: {
|
|
23
31
|
Settings: CameraSettingsDefaults;
|
|
24
32
|
defaultPosition: CameraPosition | null;
|
|
25
33
|
availablePositions: CameraPosition[];
|
|
26
34
|
};
|
|
35
|
+
ZoomSwitchControl: ZoomSwitchControlDefaults;
|
|
27
36
|
DataCaptureView: {
|
|
28
37
|
scanAreaMargins: MarginsWithUnit;
|
|
29
38
|
pointOfInterest: PointWithUnit;
|
|
@@ -31,6 +40,7 @@ export interface CoreDefaults {
|
|
|
31
40
|
logoOffset: PointWithUnit;
|
|
32
41
|
focusGesture: FocusGesture | null;
|
|
33
42
|
zoomGesture: ZoomGesture | null;
|
|
43
|
+
zoomGestures: ZoomGesture[];
|
|
34
44
|
logoStyle: LogoStyle;
|
|
35
45
|
shouldShowZoomNotification?: boolean;
|
|
36
46
|
};
|
|
@@ -2,6 +2,7 @@ export { FrameSource } from "./FrameSource";
|
|
|
2
2
|
export { FrameSourceListener } from "./FrameSourceListener";
|
|
3
3
|
export { TorchListener } from "./TorchListener";
|
|
4
4
|
export { MacroModeListener } from "./MacroModeListener";
|
|
5
|
+
export { ZoomListener } from "./ZoomListener";
|
|
5
6
|
export { FrameSourceState } from "./FrameSourceState";
|
|
6
7
|
export { FrameData } from "./FrameData";
|
|
7
8
|
export { ImageBuffer } from "./ImageBuffer";
|
|
@@ -49,6 +49,23 @@ export declare class CoreProxyAdapter {
|
|
|
49
49
|
* Unregisters the torch state event listener
|
|
50
50
|
*/
|
|
51
51
|
unregisterTorchStateListener(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Registers a persistent listener for zoom level change events
|
|
54
|
+
*/
|
|
55
|
+
registerZoomLevelListener(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Unregisters the zoom level event listener
|
|
58
|
+
*/
|
|
59
|
+
unregisterZoomLevelListener(): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Selects the zoom level on the ZoomSwitchControl. Returns the actual zoom level applied.
|
|
62
|
+
* @param viewId View identifier
|
|
63
|
+
* @param zoomLevel Desired zoom level as a zoom factor
|
|
64
|
+
*/
|
|
65
|
+
selectZoomLevel({ viewId, zoomLevel }: {
|
|
66
|
+
viewId: number;
|
|
67
|
+
zoomLevel: number;
|
|
68
|
+
}): Promise<number>;
|
|
52
69
|
/**
|
|
53
70
|
* Registers a persistent listener for macro mode change events
|
|
54
71
|
*/
|
|
@@ -36,8 +36,12 @@ export declare class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
36
36
|
private _focusGesture;
|
|
37
37
|
get focusGesture(): FocusGesture | null;
|
|
38
38
|
set focusGesture(newValue: FocusGesture | null);
|
|
39
|
-
private
|
|
39
|
+
private _zoomGestures;
|
|
40
|
+
get zoomGestures(): ZoomGesture[];
|
|
41
|
+
set zoomGestures(newValue: ZoomGesture[]);
|
|
42
|
+
/** @deprecated Use zoomGestures instead. Will be removed in a future version. */
|
|
40
43
|
get zoomGesture(): ZoomGesture | null;
|
|
44
|
+
/** @deprecated Use zoomGestures instead. Will be removed in a future version. */
|
|
41
45
|
set zoomGesture(newValue: ZoomGesture | null);
|
|
42
46
|
private _logoStyle;
|
|
43
47
|
get logoStyle(): LogoStyle;
|
|
@@ -74,4 +78,5 @@ export declare class BaseDataCaptureView extends DefaultSerializeable {
|
|
|
74
78
|
show(): Promise<void>;
|
|
75
79
|
hide(): Promise<void>;
|
|
76
80
|
setProperty<T>(name: string, value: T): void;
|
|
81
|
+
selectZoomLevel(zoomLevel: number): Promise<number>;
|
|
77
82
|
}
|
|
@@ -56,6 +56,7 @@ export declare class DataCaptureViewController extends BaseController<DataCaptur
|
|
|
56
56
|
private handleOnFocusGestureEvent;
|
|
57
57
|
private handleOnFocusGestureEventWrapper;
|
|
58
58
|
updateZoomGestureListenerSubscription(zoomGesture: ZoomGesture | null, shouldSubscribe: boolean): Promise<void>;
|
|
59
|
+
selectZoomLevel(zoomLevel: number): Promise<number>;
|
|
59
60
|
private subscribeZoomGestureListener;
|
|
60
61
|
private unsubscribeZoomGestureListener;
|
|
61
62
|
private handleOnZoomInGestureEvent;
|