trtc-electron-sdk 12.3.703 → 12.3.705-beta.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.
@@ -25,6 +25,7 @@ declare class TRTCMediaMixingDesigner {
25
25
  private previewHeight;
26
26
  private previewLeft;
27
27
  private previewTop;
28
+ private readonly BOUNDARY_ADSORPTION_THRESHOLD;
28
29
  private newSelected;
29
30
  private clickedMediaSources;
30
31
  private oldSelectedIndex;
@@ -56,6 +57,7 @@ declare class TRTCMediaMixingDesigner {
56
57
  private updatePreviewProperty;
57
58
  private updateOverlay;
58
59
  private onMove;
60
+ private doAdsorption;
59
61
  private onResize;
60
62
  private emitOnSelect;
61
63
  private onContainerMousedown;
@@ -38,6 +38,7 @@ class TRTCMediaMixingDesigner {
38
38
  this.previewHeight = 0;
39
39
  this.previewLeft = 0;
40
40
  this.previewTop = 0;
41
+ this.BOUNDARY_ADSORPTION_THRESHOLD = 10;
41
42
  this.newSelected = null;
42
43
  this.clickedMediaSources = [];
43
44
  this.oldSelectedIndex = -1;
@@ -251,6 +252,7 @@ class TRTCMediaMixingDesigner {
251
252
  right: left - this.previewLeft + this.moveAndResizeOverlay.offsetWidth,
252
253
  bottom: top - this.previewTop + this.moveAndResizeOverlay.offsetHeight,
253
254
  };
255
+ this.doAdsorption(newPreviewRect);
254
256
  // calc new mixing rect
255
257
  const newRectInMixing = {
256
258
  left: Math.round(newPreviewRect.left / this.previewScale),
@@ -264,6 +266,25 @@ class TRTCMediaMixingDesigner {
264
266
  logger_1.default.warn(`${this.logPrefix}onMove no selected media`);
265
267
  }
266
268
  }
269
+ doAdsorption(inputRect) {
270
+ const threshold = this.BOUNDARY_ADSORPTION_THRESHOLD;
271
+ if (Math.abs(inputRect.left) < threshold) {
272
+ inputRect.right = inputRect.right - inputRect.left;
273
+ inputRect.left = 0;
274
+ }
275
+ if (Math.abs(inputRect.top) < threshold) {
276
+ inputRect.bottom = inputRect.bottom - inputRect.top;
277
+ inputRect.top = 0;
278
+ }
279
+ if (Math.abs(inputRect.right - this.previewWidth) < threshold) {
280
+ inputRect.left = inputRect.left + this.previewWidth - inputRect.right;
281
+ inputRect.right = this.previewWidth;
282
+ }
283
+ if (Math.abs(inputRect.bottom - this.previewHeight) < threshold) {
284
+ inputRect.top = inputRect.top + this.previewHeight - inputRect.bottom;
285
+ inputRect.bottom = this.previewHeight;
286
+ }
287
+ }
267
288
  onResize(left, top, width, height) {
268
289
  var _a;
269
290
  logger_1.default.log(`${this.logPrefix}onResize: ${left} ${top} ${width} ${height}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "12.3.703",
3
+ "version": "12.3.705-beta.0",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",