@xmaxai/sdk 1.0.0 → 1.0.1
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/CHANGELOG.md +1 -1
- package/dist/{chunk-EGNRAZ5U.js → chunk-4YHBCQ2C.js} +3 -3
- package/dist/{chunk-EGNRAZ5U.js.map → chunk-4YHBCQ2C.js.map} +1 -1
- package/dist/{chunk-PLU2YVAS.js → chunk-LCPC56BK.js} +2 -2
- package/dist/chunk-LCPC56BK.js.map +1 -0
- package/dist/{chunk-M5QA6LWS.js → chunk-V4NR6CPP.js} +28 -9
- package/dist/chunk-V4NR6CPP.js.map +1 -0
- package/dist/{chunk-7X7QCO3O.js → chunk-VLJZ56PT.js} +25 -20
- package/dist/chunk-VLJZ56PT.js.map +1 -0
- package/dist/experimental/index.cjs +46 -22
- package/dist/experimental/index.cjs.map +1 -1
- package/dist/experimental/index.d.cts +1 -1
- package/dist/experimental/index.d.ts +1 -1
- package/dist/experimental/index.js +3 -3
- package/dist/{index-D9wwNTfP.d.ts → index-Cw8C8LbO.d.ts} +24 -3
- package/dist/{index-BEgtCLkJ.d.cts → index-Dg1ElHAj.d.cts} +24 -3
- package/dist/index.cjs +46 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +8 -8
- package/dist/react/index.cjs +25 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +3 -3
- package/dist/video-file-stream-K7GQMIJ5.js +4 -0
- package/dist/{video-file-stream-UXJ6TNIB.js.map → video-file-stream-K7GQMIJ5.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-7X7QCO3O.js.map +0 -1
- package/dist/chunk-M5QA6LWS.js.map +0 -1
- package/dist/chunk-PLU2YVAS.js.map +0 -1
- package/dist/video-file-stream-UXJ6TNIB.js +0 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { S as SDKLocale, a as SDKI18n, b as XmaxOpenClient } from './rtc-manager-gYDkADGw.cjs';
|
|
2
2
|
export { A as ACTIVE_STATUS, C as ClientOptions, c as CosSts, L as LocalPublishReadyResult, M as MEDIA_TIME_EPSILON_S, d as MEDIA_TIME_LOOP_JUMP_S, e as MOBILE_PUBLISH_MAX_WIDTH_PX, f as ModelExtra, P as PUBLISH_COLD_FRAME_TIMEOUT_MS, g as PUBLISH_COLD_MIN_FRAMES, h as PUBLISH_COLD_WARMUP_MS, i as PUBLISH_START_FRAME_TIMEOUT_MS, j as PUBLISH_START_MIN_FRAMES, k as PUBLISH_WARM_SKIP_MS, l as RTC_PUBLISH_FPS, m as RTC_PUBLISH_FPS_MOBILE, n as RTC_PUBLISH_FPS_WEB, o as RTC_PUBLISH_FRAME_INTERVAL_MS, p as RTC_PUBLISH_FRAME_INTERVAL_S, q as RemoteSeiReceivedPayload, r as ResolveRtcPublishFpsOptions, s as RtcJoinInfo, t as RtcLogEntry, u as RtcManager, R as RtcStateSnapshot, v as SDKMessages, w as Session, x as StsCredentials, U as UploadImageResult, y as UploadVideoResult, z as XMAX_OPEN_API_BASE_URLS, B as XMAX_OPEN_API_PRODUCTION_BASE_URL, D as XmaxLogEntry, E as XmaxSdkRegion, F as createSDKI18n, G as getDefaultMessages, H as isMobilePublishEnvironment, I as resolveRtcPublishFps, J as resolveRtcPublishFrameIntervalS } from './rtc-manager-gYDkADGw.cjs';
|
|
3
|
-
export { D as DragTrackController, a as DragTrackControllerOptions, N as NativeCameraStream, O as OpenNativeCameraStreamOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, p as createNativeCameraStream, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, x as openNativeCameraStream, y as syncDragSurfaceToVideo } from './index-
|
|
3
|
+
export { D as DragTrackController, a as DragTrackControllerOptions, N as NativeCameraStream, O as OpenNativeCameraStreamOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, p as createNativeCameraStream, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, x as openNativeCameraStream, y as syncDragSurfaceToVideo } from './index-Dg1ElHAj.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Open API business error codes (46xxx) mapped to user-facing messages.
|
|
7
|
-
* Source: Open API v1 error code tables. Codes not listed here fall back to
|
|
8
|
-
* generic retry message
|
|
7
|
+
* Source: Open API v1 error code tables. Codes not listed here fall back to the
|
|
8
|
+
* backend `message` when present, otherwise a generic retry message for Open
|
|
9
|
+
* API endpoints (see `errors.requestRetry`).
|
|
9
10
|
*/
|
|
10
11
|
type LocalizedMessage = Record<SDKLocale, string>;
|
|
11
12
|
declare const API_ERROR_MESSAGES: Record<string, LocalizedMessage>;
|
|
@@ -24,6 +25,8 @@ type StartRtcRoomEvent = {
|
|
|
24
25
|
ref_image_path?: string;
|
|
25
26
|
ref_image?: string;
|
|
26
27
|
static_generate?: boolean;
|
|
28
|
+
/** MoX instant — COS URL of the source still; preferred over under-bitrate RTC frames. */
|
|
29
|
+
static_image_path?: string;
|
|
27
30
|
} & Record<string, unknown>;
|
|
28
31
|
};
|
|
29
32
|
type StopRtcRoomEvent = {
|
|
@@ -52,6 +55,8 @@ declare function createStartRtcRoomEvent(input: {
|
|
|
52
55
|
refImage?: string;
|
|
53
56
|
/** MoX instant — static image generation that follows drag tracks. */
|
|
54
57
|
staticGenerate?: boolean;
|
|
58
|
+
/** MoX instant — COS URL of the source still (`static_image_path`). */
|
|
59
|
+
staticImagePath?: string;
|
|
55
60
|
extraParams?: Record<string, unknown>;
|
|
56
61
|
}): StartRtcRoomEvent;
|
|
57
62
|
declare function createStopRtcRoomEvent(input: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { S as SDKLocale, a as SDKI18n, b as XmaxOpenClient } from './rtc-manager-gYDkADGw.js';
|
|
2
2
|
export { A as ACTIVE_STATUS, C as ClientOptions, c as CosSts, L as LocalPublishReadyResult, M as MEDIA_TIME_EPSILON_S, d as MEDIA_TIME_LOOP_JUMP_S, e as MOBILE_PUBLISH_MAX_WIDTH_PX, f as ModelExtra, P as PUBLISH_COLD_FRAME_TIMEOUT_MS, g as PUBLISH_COLD_MIN_FRAMES, h as PUBLISH_COLD_WARMUP_MS, i as PUBLISH_START_FRAME_TIMEOUT_MS, j as PUBLISH_START_MIN_FRAMES, k as PUBLISH_WARM_SKIP_MS, l as RTC_PUBLISH_FPS, m as RTC_PUBLISH_FPS_MOBILE, n as RTC_PUBLISH_FPS_WEB, o as RTC_PUBLISH_FRAME_INTERVAL_MS, p as RTC_PUBLISH_FRAME_INTERVAL_S, q as RemoteSeiReceivedPayload, r as ResolveRtcPublishFpsOptions, s as RtcJoinInfo, t as RtcLogEntry, u as RtcManager, R as RtcStateSnapshot, v as SDKMessages, w as Session, x as StsCredentials, U as UploadImageResult, y as UploadVideoResult, z as XMAX_OPEN_API_BASE_URLS, B as XMAX_OPEN_API_PRODUCTION_BASE_URL, D as XmaxLogEntry, E as XmaxSdkRegion, F as createSDKI18n, G as getDefaultMessages, H as isMobilePublishEnvironment, I as resolveRtcPublishFps, J as resolveRtcPublishFrameIntervalS } from './rtc-manager-gYDkADGw.js';
|
|
3
|
-
export { D as DragTrackController, a as DragTrackControllerOptions, N as NativeCameraStream, O as OpenNativeCameraStreamOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, p as createNativeCameraStream, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, x as openNativeCameraStream, y as syncDragSurfaceToVideo } from './index-
|
|
3
|
+
export { D as DragTrackController, a as DragTrackControllerOptions, N as NativeCameraStream, O as OpenNativeCameraStreamOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, p as createNativeCameraStream, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, x as openNativeCameraStream, y as syncDragSurfaceToVideo } from './index-Cw8C8LbO.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Open API business error codes (46xxx) mapped to user-facing messages.
|
|
7
|
-
* Source: Open API v1 error code tables. Codes not listed here fall back to
|
|
8
|
-
* generic retry message
|
|
7
|
+
* Source: Open API v1 error code tables. Codes not listed here fall back to the
|
|
8
|
+
* backend `message` when present, otherwise a generic retry message for Open
|
|
9
|
+
* API endpoints (see `errors.requestRetry`).
|
|
9
10
|
*/
|
|
10
11
|
type LocalizedMessage = Record<SDKLocale, string>;
|
|
11
12
|
declare const API_ERROR_MESSAGES: Record<string, LocalizedMessage>;
|
|
@@ -24,6 +25,8 @@ type StartRtcRoomEvent = {
|
|
|
24
25
|
ref_image_path?: string;
|
|
25
26
|
ref_image?: string;
|
|
26
27
|
static_generate?: boolean;
|
|
28
|
+
/** MoX instant — COS URL of the source still; preferred over under-bitrate RTC frames. */
|
|
29
|
+
static_image_path?: string;
|
|
27
30
|
} & Record<string, unknown>;
|
|
28
31
|
};
|
|
29
32
|
type StopRtcRoomEvent = {
|
|
@@ -52,6 +55,8 @@ declare function createStartRtcRoomEvent(input: {
|
|
|
52
55
|
refImage?: string;
|
|
53
56
|
/** MoX instant — static image generation that follows drag tracks. */
|
|
54
57
|
staticGenerate?: boolean;
|
|
58
|
+
/** MoX instant — COS URL of the source still (`static_image_path`). */
|
|
59
|
+
staticImagePath?: string;
|
|
55
60
|
extraParams?: Record<string, unknown>;
|
|
56
61
|
}): StartRtcRoomEvent;
|
|
57
62
|
declare function createStopRtcRoomEvent(input: {
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { RealtimePrewarmHandle, RealtimeSession, createRemoteViewHost, createXmaxClient, observeDragSurfaceVideoSync, resolveRefImageUrl, syncDragSurfaceToVideo } from './chunk-
|
|
2
|
-
import { requestCameraMediaStream } from './chunk-
|
|
3
|
-
export { ACTIVE_STATUS, PREVIEW_CONTAIN_ATTR, PREVIEW_COVER_ATTR, PREVIEW_OUTPUT_LAYOUT_ATTR, PREVIEW_UPLOAD_FIT_ATTR, PREVIEW_UPLOAD_LAYOUT_ATTR, PUBLISH_COLD_FRAME_TIMEOUT_MS, PUBLISH_COLD_MIN_FRAMES, PUBLISH_COLD_WARMUP_MS, PUBLISH_START_FRAME_TIMEOUT_MS, PUBLISH_START_MIN_FRAMES, PUBLISH_WARM_SKIP_MS, RtcManager, XMAX_OPEN_API_BASE_URLS, XMAX_OPEN_API_PRODUCTION_BASE_URL, XmaxOpenClient, applyUploadPreviewMediaLayout, classifyCameraAccessError, createDragTrackController, createNativeCameraStream, createStartRtcRoomEvent, createStopRtcRoomEvent, createTaskUid, createTracksRtcRoomEvent, getCameraEnvironmentIssue, getContentRect, isCameraAccessError, mapTargetPointToCanvas, mapViewportPointToCoordinateSpace, models, observeUploadPreviewMediaLayout, openNativeCameraStream, requestCameraMediaStream, stabilizeCameraVideoTrack } from './chunk-
|
|
4
|
-
import { computeCenterCropRect, drawSourceCenterCrop } from './chunk-
|
|
5
|
-
export { createVideoFileStream } from './chunk-
|
|
6
|
-
import { createSDKI18n, resolveUploadVideoSize, resolveRtcPublishFps, mountCaptureVideo } from './chunk-
|
|
7
|
-
export { API_ERROR_MESSAGES, DEFAULT_SESSION_TARGET_SIZE, MEDIA_TIME_EPSILON_S, MEDIA_TIME_LOOP_JUMP_S, MOBILE_PUBLISH_MAX_WIDTH_PX, PREVIEW_CONTAINER_ASPECT_RATIO, RTC_PUBLISH_FPS, RTC_PUBLISH_FPS_MOBILE, RTC_PUBLISH_FPS_WEB, RTC_PUBLISH_FRAME_INTERVAL_MS, RTC_PUBLISH_FRAME_INTERVAL_S, createSDKI18n, getDefaultMessages, isMobilePublishEnvironment, resolveAdaptiveRtcVideoSize, resolveApiErrorMessage, resolvePreviewAspectRatio, resolveRtcPublishFps, resolveRtcPublishFrameIntervalS, resolveSessionTargetSize, resolveUploadPublishSize, resolveUploadVideoSize } from './chunk-
|
|
1
|
+
export { RealtimePrewarmHandle, RealtimeSession, createRemoteViewHost, createXmaxClient, observeDragSurfaceVideoSync, resolveRefImageUrl, syncDragSurfaceToVideo } from './chunk-VLJZ56PT.js';
|
|
2
|
+
import { requestCameraMediaStream } from './chunk-V4NR6CPP.js';
|
|
3
|
+
export { ACTIVE_STATUS, PREVIEW_CONTAIN_ATTR, PREVIEW_COVER_ATTR, PREVIEW_OUTPUT_LAYOUT_ATTR, PREVIEW_UPLOAD_FIT_ATTR, PREVIEW_UPLOAD_LAYOUT_ATTR, PUBLISH_COLD_FRAME_TIMEOUT_MS, PUBLISH_COLD_MIN_FRAMES, PUBLISH_COLD_WARMUP_MS, PUBLISH_START_FRAME_TIMEOUT_MS, PUBLISH_START_MIN_FRAMES, PUBLISH_WARM_SKIP_MS, RtcManager, XMAX_OPEN_API_BASE_URLS, XMAX_OPEN_API_PRODUCTION_BASE_URL, XmaxOpenClient, applyUploadPreviewMediaLayout, classifyCameraAccessError, createDragTrackController, createNativeCameraStream, createStartRtcRoomEvent, createStopRtcRoomEvent, createTaskUid, createTracksRtcRoomEvent, getCameraEnvironmentIssue, getContentRect, isCameraAccessError, mapTargetPointToCanvas, mapViewportPointToCoordinateSpace, models, observeUploadPreviewMediaLayout, openNativeCameraStream, requestCameraMediaStream, stabilizeCameraVideoTrack } from './chunk-V4NR6CPP.js';
|
|
4
|
+
import { computeCenterCropRect, drawSourceCenterCrop } from './chunk-4YHBCQ2C.js';
|
|
5
|
+
export { createVideoFileStream } from './chunk-4YHBCQ2C.js';
|
|
6
|
+
import { createSDKI18n, resolveUploadVideoSize, resolveRtcPublishFps, mountCaptureVideo } from './chunk-LCPC56BK.js';
|
|
7
|
+
export { API_ERROR_MESSAGES, DEFAULT_SESSION_TARGET_SIZE, MEDIA_TIME_EPSILON_S, MEDIA_TIME_LOOP_JUMP_S, MOBILE_PUBLISH_MAX_WIDTH_PX, PREVIEW_CONTAINER_ASPECT_RATIO, RTC_PUBLISH_FPS, RTC_PUBLISH_FPS_MOBILE, RTC_PUBLISH_FPS_WEB, RTC_PUBLISH_FRAME_INTERVAL_MS, RTC_PUBLISH_FRAME_INTERVAL_S, createSDKI18n, getDefaultMessages, isMobilePublishEnvironment, resolveAdaptiveRtcVideoSize, resolveApiErrorMessage, resolvePreviewAspectRatio, resolveRtcPublishFps, resolveRtcPublishFrameIntervalS, resolveSessionTargetSize, resolveUploadPublishSize, resolveUploadVideoSize } from './chunk-LCPC56BK.js';
|
|
8
8
|
|
|
9
9
|
// src/rtc/image-file-stream.ts
|
|
10
10
|
function loadImageElement(url, crossOrigin) {
|
|
@@ -143,7 +143,7 @@ async function createMediaFileStream(fileOrUrl, options = {}) {
|
|
|
143
143
|
return createImageFileStream(fileOrUrl, options);
|
|
144
144
|
}
|
|
145
145
|
if (isVideoMediaFile(fileOrUrl)) {
|
|
146
|
-
const { createVideoFileStream: createVideoFileStream2 } = await import('./video-file-stream-
|
|
146
|
+
const { createVideoFileStream: createVideoFileStream2 } = await import('./video-file-stream-K7GQMIJ5.js');
|
|
147
147
|
return createVideoFileStream2(fileOrUrl, options);
|
|
148
148
|
}
|
|
149
149
|
const i18n = options.i18n ?? createSDKI18n();
|
package/dist/react/index.cjs
CHANGED
|
@@ -539,7 +539,8 @@ var XmaxOpenClient = class {
|
|
|
539
539
|
return p.data;
|
|
540
540
|
}
|
|
541
541
|
const mappedMessage = resolveApiErrorMessage(p.code, this.i18n.locale);
|
|
542
|
-
const
|
|
542
|
+
const backendMessage = typeof p.message === "string" && p.message.trim() ? p.message.trim() : void 0;
|
|
543
|
+
const errorMessage = mappedMessage ?? backendMessage ?? this.i18n.t("errors.requestRetry");
|
|
543
544
|
throw new Error(errorMessage);
|
|
544
545
|
} catch (error) {
|
|
545
546
|
if (this.isAbortError(error)) {
|
|
@@ -691,6 +692,7 @@ function createStartRtcRoomEvent(input) {
|
|
|
691
692
|
const resolvedPrompt = input.prompt?.trim() ?? "";
|
|
692
693
|
const refImagePath = input.refImagePath?.trim() || input.refImage?.trim() || void 0;
|
|
693
694
|
const useRefImage = !!refImagePath;
|
|
695
|
+
const staticImagePath = input.staticImagePath?.trim() || void 0;
|
|
694
696
|
return {
|
|
695
697
|
event: "start",
|
|
696
698
|
user_id: input.userId?.trim() || void 0,
|
|
@@ -702,7 +704,9 @@ function createStartRtcRoomEvent(input) {
|
|
|
702
704
|
prompt: resolvedPrompt,
|
|
703
705
|
ref_image_path: useRefImage ? refImagePath : void 0,
|
|
704
706
|
ref_image: useRefImage ? refImagePath : void 0,
|
|
705
|
-
|
|
707
|
+
// Instant-only — omit when false/undefined so non-instant starts never carry leftover flags.
|
|
708
|
+
static_generate: input.staticGenerate === true ? true : void 0,
|
|
709
|
+
static_image_path: staticImagePath,
|
|
706
710
|
...input.extraParams ?? {}
|
|
707
711
|
}
|
|
708
712
|
};
|
|
@@ -1103,7 +1107,7 @@ var _RtcManager = class _RtcManager {
|
|
|
1103
1107
|
this.lastRemoteSei = null;
|
|
1104
1108
|
this.lastRemoteSeiUserId = null;
|
|
1105
1109
|
this.hasLoggedSeiSendFailure = false;
|
|
1106
|
-
if (previousExpectedRemoteSei !== this.expectedRemoteSei && this.remoteVideoUserId) {
|
|
1110
|
+
if (previousExpectedRemoteSei !== this.expectedRemoteSei && this.remoteVideoUserId && !this.preserveRemoteDom) {
|
|
1107
1111
|
this.pendingRemoteVideoUserId = this.remoteVideoUserId;
|
|
1108
1112
|
this.remoteVideoUserId = null;
|
|
1109
1113
|
}
|
|
@@ -3935,6 +3939,7 @@ function drawNeon(ctx, segs, container, targetSize, dpr, fitMode, mirrored) {
|
|
|
3935
3939
|
}
|
|
3936
3940
|
var DragTrackController = class {
|
|
3937
3941
|
constructor(container, options) {
|
|
3942
|
+
this.strokeActive = false;
|
|
3938
3943
|
this.activePointers = /* @__PURE__ */ new Map();
|
|
3939
3944
|
this.lastTargetPoints = /* @__PURE__ */ new Map();
|
|
3940
3945
|
this.segQueue = [];
|
|
@@ -3944,6 +3949,8 @@ var DragTrackController = class {
|
|
|
3944
3949
|
this.resizeObserver = null;
|
|
3945
3950
|
this.container = container;
|
|
3946
3951
|
this.onTracks = options.onTracks;
|
|
3952
|
+
this.onStrokeStart = options.onStrokeStart;
|
|
3953
|
+
this.onStrokeEnd = options.onStrokeEnd;
|
|
3947
3954
|
this.targetSize = options.targetSize;
|
|
3948
3955
|
this.fitMode = options.fitMode ?? "cover";
|
|
3949
3956
|
this.mirrored = options.mirrored ?? false;
|
|
@@ -4114,11 +4121,17 @@ var DragTrackController = class {
|
|
|
4114
4121
|
this.flushTracks();
|
|
4115
4122
|
}, 30);
|
|
4116
4123
|
}
|
|
4117
|
-
finishStroke() {
|
|
4124
|
+
finishStroke(emitEnd = false) {
|
|
4125
|
+
const wasActive = this.strokeActive;
|
|
4126
|
+
this.strokeActive = false;
|
|
4118
4127
|
this.stopSampling();
|
|
4119
4128
|
this.stopDrawLoop();
|
|
4120
4129
|
this.segQueue.length = 0;
|
|
4121
4130
|
this.clearCanvas();
|
|
4131
|
+
if (emitEnd && wasActive && this.onStrokeEnd) {
|
|
4132
|
+
Promise.resolve(this.onStrokeEnd()).catch(() => {
|
|
4133
|
+
});
|
|
4134
|
+
}
|
|
4122
4135
|
}
|
|
4123
4136
|
handlePointerDown(e) {
|
|
4124
4137
|
if (!this.enabled) {
|
|
@@ -4142,6 +4155,12 @@ var DragTrackController = class {
|
|
|
4142
4155
|
if (targetPoint) {
|
|
4143
4156
|
this.lastTargetPoints.set(e.pointerId, targetPoint);
|
|
4144
4157
|
}
|
|
4158
|
+
const strokeWasActive = this.strokeActive;
|
|
4159
|
+
this.strokeActive = true;
|
|
4160
|
+
if (!strokeWasActive && this.onStrokeStart) {
|
|
4161
|
+
Promise.resolve(this.onStrokeStart()).catch(() => {
|
|
4162
|
+
});
|
|
4163
|
+
}
|
|
4145
4164
|
this.startDrawLoop();
|
|
4146
4165
|
this.startSampling();
|
|
4147
4166
|
}
|
|
@@ -4174,7 +4193,7 @@ var DragTrackController = class {
|
|
|
4174
4193
|
} catch {
|
|
4175
4194
|
}
|
|
4176
4195
|
if (this.activePointers.size === 0) {
|
|
4177
|
-
this.finishStroke();
|
|
4196
|
+
this.finishStroke(true);
|
|
4178
4197
|
}
|
|
4179
4198
|
}
|
|
4180
4199
|
handlePointerCancel(e) {
|
|
@@ -4184,7 +4203,7 @@ var DragTrackController = class {
|
|
|
4184
4203
|
this.activePointers.delete(e.pointerId);
|
|
4185
4204
|
this.lastTargetPoints.delete(e.pointerId);
|
|
4186
4205
|
if (this.activePointers.size === 0) {
|
|
4187
|
-
this.finishStroke();
|
|
4206
|
+
this.finishStroke(true);
|
|
4188
4207
|
}
|
|
4189
4208
|
}
|
|
4190
4209
|
};
|