@ezuikit/player-theme 2.1.4-beta.3 → 3.0.0-beta.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/dist/constant.js +7 -14
- package/dist/index.js +71 -1749
- package/dist/index.mjs +56 -1734
- package/dist/index.umd.js +465 -2236
- package/dist/style.css +8 -3
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +12 -5
- package/package.json +23 -7
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme
|
|
3
|
-
* Copyright (c) 2026-04
|
|
2
|
+
* @ezuikit/player-theme v3.0.0-beta.1
|
|
3
|
+
* Copyright (c) 2026-05-04 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
@@ -9,10 +9,12 @@ var EventEmitter = require('eventemitter3');
|
|
|
9
9
|
var Picker = require('@skax/picker');
|
|
10
10
|
var delegate = require('@skax/delegate');
|
|
11
11
|
var deepmerge = require('deepmerge');
|
|
12
|
-
var
|
|
12
|
+
var utilsTools = require('@ezuikit/utils-tools');
|
|
13
13
|
var screenfull = require('screenfull');
|
|
14
14
|
var I18n = require('@ezuikit/utils-i18n');
|
|
15
15
|
var Logger = require('@ezuikit/utils-logger');
|
|
16
|
+
var Zoom$1 = require('@ezuikit/control-zoom');
|
|
17
|
+
var controlPtz = require('@ezuikit/control-ptz');
|
|
16
18
|
var controlDatePicker = require('@ezuikit/control-date-picker');
|
|
17
19
|
var controlTimeLine = require('@ezuikit/control-time-line');
|
|
18
20
|
|
|
@@ -56,18 +58,11 @@ var THEME_PROPS = [
|
|
|
56
58
|
* | rec | cloudRec | cloudRecord |
|
|
57
59
|
* |:---------------------:|:------------:|:---------------:|
|
|
58
60
|
* | 本地回放(SDK存储回放) | 云存储回放 | 云录制回放 |
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
'cloudRec',
|
|
65
|
-
'cloudRecord'
|
|
66
|
-
] : [
|
|
67
|
-
'rec',
|
|
68
|
-
'cloudRec'
|
|
69
|
-
];
|
|
70
|
-
};
|
|
61
|
+
*/ var REC_GROUP = [
|
|
62
|
+
'rec',
|
|
63
|
+
'cloudRec',
|
|
64
|
+
'cloudRecord'
|
|
65
|
+
];
|
|
71
66
|
/**
|
|
72
67
|
* 设备信息
|
|
73
68
|
*
|
|
@@ -1365,7 +1360,7 @@ function _create_for_of_iterator_helper_loose$2(o, allowArrayLike) {
|
|
|
1365
1360
|
* ```ts
|
|
1366
1361
|
* Utils.isMobile // true | false
|
|
1367
1362
|
* ```
|
|
1368
|
-
*/ Utils.isMobile =
|
|
1363
|
+
*/ Utils.isMobile = utilsTools.isMobile();
|
|
1369
1364
|
|
|
1370
1365
|
function _defineProperties$7(target, props) {
|
|
1371
1366
|
for(var i = 0; i < props.length; i++){
|
|
@@ -4655,7 +4650,7 @@ var ZOOM_DEFAULT_OPTIONS = {
|
|
|
4655
4650
|
/**
|
|
4656
4651
|
* 电子放大控件
|
|
4657
4652
|
* @category Control
|
|
4658
|
-
*/ var Zoom
|
|
4653
|
+
*/ var Zoom = /*#__PURE__*/ function(Control) {
|
|
4659
4654
|
_inherits$j(Zoom, Control);
|
|
4660
4655
|
function Zoom(options) {
|
|
4661
4656
|
var _this;
|
|
@@ -4787,735 +4782,6 @@ var ZOOM_DEFAULT_OPTIONS = {
|
|
|
4787
4782
|
return Zoom;
|
|
4788
4783
|
}(Control);
|
|
4789
4784
|
|
|
4790
|
-
function getDefaultExportFromCjs (x) {
|
|
4791
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
4792
|
-
}
|
|
4793
|
-
|
|
4794
|
-
/*
|
|
4795
|
-
* @ezuikit/control-zoom v0.0.2
|
|
4796
|
-
* Copyright (c) 2026-04-02 Ezviz-OpenBiz
|
|
4797
|
-
* Released under the MIT License.
|
|
4798
|
-
*/
|
|
4799
|
-
|
|
4800
|
-
var dist$1;
|
|
4801
|
-
var hasRequiredDist$1;
|
|
4802
|
-
|
|
4803
|
-
function requireDist$1 () {
|
|
4804
|
-
if (hasRequiredDist$1) return dist$1;
|
|
4805
|
-
hasRequiredDist$1 = 1;
|
|
4806
|
-
|
|
4807
|
-
/**
|
|
4808
|
-
* Zoom position
|
|
4809
|
-
*
|
|
4810
|
-
*/ function _defineProperties(target, props) {
|
|
4811
|
-
for(var i = 0; i < props.length; i++){
|
|
4812
|
-
var descriptor = props[i];
|
|
4813
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
4814
|
-
descriptor.configurable = true;
|
|
4815
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
4816
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
4817
|
-
}
|
|
4818
|
-
}
|
|
4819
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
4820
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
4821
|
-
return Constructor;
|
|
4822
|
-
}
|
|
4823
|
-
var ZOOM_DEFAULT_POSITION = [
|
|
4824
|
-
0,
|
|
4825
|
-
0
|
|
4826
|
-
];
|
|
4827
|
-
/**
|
|
4828
|
-
* 默认值
|
|
4829
|
-
*/ var DefaultOptions = {
|
|
4830
|
-
initialZoom: 1,
|
|
4831
|
-
defaultCursor: 'pointer',
|
|
4832
|
-
scrollVelocity: 0.1,
|
|
4833
|
-
animDuration: 0.25,
|
|
4834
|
-
allowZoom: true,
|
|
4835
|
-
allowPan: true,
|
|
4836
|
-
onChange: function() {},
|
|
4837
|
-
onTranslateChange: function() {},
|
|
4838
|
-
onTap: function() {},
|
|
4839
|
-
max: 8,
|
|
4840
|
-
min: 1,
|
|
4841
|
-
zoomStep: 0.1,
|
|
4842
|
-
allowTouchEvents: false,
|
|
4843
|
-
allowWheel: true,
|
|
4844
|
-
ignoredMouseButtons: [],
|
|
4845
|
-
doubleTouchMaxDelay: 300,
|
|
4846
|
-
decelerationDuration: 750
|
|
4847
|
-
};
|
|
4848
|
-
/**
|
|
4849
|
-
* dom 节点放大和拖动
|
|
4850
|
-
*
|
|
4851
|
-
*/ var Zoom = /*#__PURE__*/ function() {
|
|
4852
|
-
function Zoom(container, options) {
|
|
4853
|
-
var _this = this;
|
|
4854
|
-
this._dragging = false;
|
|
4855
|
-
/**
|
|
4856
|
-
* 销毁
|
|
4857
|
-
* destroy
|
|
4858
|
-
*/ this.destroy = function() {
|
|
4859
|
-
_this.setAllowZoom(false);
|
|
4860
|
-
_this.reset();
|
|
4861
|
-
_this.removeEventListeners();
|
|
4862
|
-
};
|
|
4863
|
-
/**
|
|
4864
|
-
* 设置是否旋转
|
|
4865
|
-
* @param trans - 是否transform
|
|
4866
|
-
*/ this.setTransform = function(trans) {
|
|
4867
|
-
_this.transform = trans;
|
|
4868
|
-
};
|
|
4869
|
-
/**
|
|
4870
|
-
* 获取是否旋转
|
|
4871
|
-
* @returns
|
|
4872
|
-
*/ this.getTransform = function() {
|
|
4873
|
-
return _this.transform;
|
|
4874
|
-
};
|
|
4875
|
-
/**
|
|
4876
|
-
* 更新x轴和Y轴平移值
|
|
4877
|
-
*/ this.updateTranslate = function() {
|
|
4878
|
-
var translateX = 0;
|
|
4879
|
-
var translateY = 0;
|
|
4880
|
-
if (_this.percentPos[0] < 0) {
|
|
4881
|
-
translateX = _this.percentPos[0] < -(0.5 * (_this.zoom - 1)) ? -(0.5 * (_this.zoom - 1)) : _this.percentPos[0];
|
|
4882
|
-
} else {
|
|
4883
|
-
translateX = _this.percentPos[0] > 0.5 * (_this.zoom - 1) ? 0.5 * (_this.zoom - 1) : _this.percentPos[0];
|
|
4884
|
-
}
|
|
4885
|
-
if (_this.percentPos[1] < 0) {
|
|
4886
|
-
translateY = _this.percentPos[1] < -(0.5 * (_this.zoom - 1)) ? -(0.5 * (_this.zoom - 1)) : _this.percentPos[1];
|
|
4887
|
-
} else {
|
|
4888
|
-
translateY = _this.percentPos[1] > 0.5 * (_this.zoom - 1) ? 0.5 * (_this.zoom - 1) : _this.percentPos[1];
|
|
4889
|
-
}
|
|
4890
|
-
_this.percentPos = [
|
|
4891
|
-
translateX,
|
|
4892
|
-
translateY
|
|
4893
|
-
];
|
|
4894
|
-
};
|
|
4895
|
-
/**
|
|
4896
|
-
* 更新容器样式
|
|
4897
|
-
*/ this.update = function() {
|
|
4898
|
-
if (!_this.container) return;
|
|
4899
|
-
_this.updateTranslate();
|
|
4900
|
-
_this.container.style.transition = "transform ease-out " + _this.transition + "s";
|
|
4901
|
-
_this.container.style.transform = "translate3d(" + _this.percentPos[0] * 100 + "%, " + _this.percentPos[1] * 100 + "%, 0) scale(" + _this.zoom + ")";
|
|
4902
|
-
};
|
|
4903
|
-
/**
|
|
4904
|
-
* 设置支持缩放
|
|
4905
|
-
* @param allow
|
|
4906
|
-
*/ this.setAllowZoom = function(allow) {
|
|
4907
|
-
_this.options.allowZoom = allow;
|
|
4908
|
-
};
|
|
4909
|
-
/**
|
|
4910
|
-
* 设置缩放值
|
|
4911
|
-
* @param zoom - 缩放值
|
|
4912
|
-
* @param reset - 是否重置
|
|
4913
|
-
*/ this.setZoom = function(zoom, reset) {
|
|
4914
|
-
zoom = parseFloat(zoom.toFixed(_this.getPrecision(_this.options.zoomStep)));
|
|
4915
|
-
if (_this.zoom !== zoom) {
|
|
4916
|
-
_this.zoom = zoom;
|
|
4917
|
-
_this.update();
|
|
4918
|
-
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, +_this.zoom.toFixed(_this.getPrecision(_this.options.zoomStep)), reset);
|
|
4919
|
-
}
|
|
4920
|
-
};
|
|
4921
|
-
/**
|
|
4922
|
-
* 获取缩放值
|
|
4923
|
-
* @returns
|
|
4924
|
-
*/ this.getZoom = function() {
|
|
4925
|
-
return _this.zoom;
|
|
4926
|
-
};
|
|
4927
|
-
/**
|
|
4928
|
-
* 设置位置
|
|
4929
|
-
* @param pos - 位置 [X轴坐标转换, Y轴坐标转换]
|
|
4930
|
-
*/ this.setPos = function(pos) {
|
|
4931
|
-
var _this_container, _this_container1;
|
|
4932
|
-
var containerWidth = (_this_container = _this.container) == null ? void 0 : _this_container.clientWidth;
|
|
4933
|
-
var containerHeight = (_this_container1 = _this.container) == null ? void 0 : _this_container1.clientHeight;
|
|
4934
|
-
if (+_this.pos[0] !== pos[0] || +_this.pos[1] !== pos[1]) {
|
|
4935
|
-
_this.percentPos = [
|
|
4936
|
-
pos[0] / containerWidth,
|
|
4937
|
-
pos[1] / containerHeight
|
|
4938
|
-
];
|
|
4939
|
-
_this.update();
|
|
4940
|
-
_this.options.onTranslateChange == null ? void 0 : _this.options.onTranslateChange.call(_this.options, {
|
|
4941
|
-
posX: pos[0],
|
|
4942
|
-
posY: pos[1]
|
|
4943
|
-
});
|
|
4944
|
-
}
|
|
4945
|
-
};
|
|
4946
|
-
/**
|
|
4947
|
-
* 设置过渡时间
|
|
4948
|
-
* @param duration - 过渡时间, 单位秒
|
|
4949
|
-
*/ this.setTransitionDuration = function(duration) {
|
|
4950
|
-
_this.transition = duration;
|
|
4951
|
-
_this.update();
|
|
4952
|
-
};
|
|
4953
|
-
/**
|
|
4954
|
-
* 设置鼠标样式
|
|
4955
|
-
* @param cursor
|
|
4956
|
-
* @returns
|
|
4957
|
-
*/ this.setCursor = function(cursor) {
|
|
4958
|
-
if (!_this.container) return;
|
|
4959
|
-
_this.container.style.cssText += "cursor:" + cursor + ";";
|
|
4960
|
-
_this.cursor = cursor;
|
|
4961
|
-
};
|
|
4962
|
-
this.zoomIn = function(value) {
|
|
4963
|
-
var newPosX = _this.pos[0];
|
|
4964
|
-
var newPosY = _this.pos[1];
|
|
4965
|
-
var prevZoom = _this.zoom;
|
|
4966
|
-
var _this_options_max, _this_options_max1;
|
|
4967
|
-
var newZoom = prevZoom + value < ((_this_options_max = _this.options.max) != null ? _this_options_max : 8) ? prevZoom + value : (_this_options_max1 = _this.options.max) != null ? _this_options_max1 : 8;
|
|
4968
|
-
if (newZoom !== prevZoom) {
|
|
4969
|
-
newPosX = newPosX * (newZoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);
|
|
4970
|
-
newPosY = newPosY * (newZoom - 1) / (prevZoom > 1 ? prevZoom - 1 : prevZoom);
|
|
4971
|
-
}
|
|
4972
|
-
_this.setZoom(newZoom);
|
|
4973
|
-
_this.setPos([
|
|
4974
|
-
newPosX,
|
|
4975
|
-
newPosY
|
|
4976
|
-
]);
|
|
4977
|
-
_this.setTransitionDuration(_this.options.animDuration);
|
|
4978
|
-
};
|
|
4979
|
-
this.zoomOut = function(value) {
|
|
4980
|
-
var newPosX = _this.pos[0];
|
|
4981
|
-
var newPosY = _this.pos[1];
|
|
4982
|
-
var prevZoom = _this.zoom;
|
|
4983
|
-
var _this_options_min, _this_options_min1;
|
|
4984
|
-
var newZoom = prevZoom - value > ((_this_options_min = _this.options.min) != null ? _this_options_min : 1) ? prevZoom - value : (_this_options_min1 = _this.options.min) != null ? _this_options_min1 : 1;
|
|
4985
|
-
if (newZoom !== prevZoom) {
|
|
4986
|
-
newPosX = newPosX * (newZoom - 1) / (prevZoom - 1);
|
|
4987
|
-
newPosY = newPosY * (newZoom - 1) / (prevZoom - 1);
|
|
4988
|
-
}
|
|
4989
|
-
_this.setZoom(newZoom);
|
|
4990
|
-
_this.setPos([
|
|
4991
|
-
newPosX,
|
|
4992
|
-
newPosY
|
|
4993
|
-
]);
|
|
4994
|
-
_this.setTransitionDuration(_this.options.animDuration);
|
|
4995
|
-
};
|
|
4996
|
-
this.zoomToZone = function(relX, relY, relWidth, relHeight) {
|
|
4997
|
-
var _this_container;
|
|
4998
|
-
if (!_this.container) return;
|
|
4999
|
-
var newPosX = _this.pos[0];
|
|
5000
|
-
var newPosY = _this.pos[1];
|
|
5001
|
-
var parentRect = ((_this_container = _this.container) == null ? void 0 : _this_container.parentNode).getBoundingClientRect();
|
|
5002
|
-
var prevZoom = _this.zoom;
|
|
5003
|
-
// Calculate zoom factor to scale the zone
|
|
5004
|
-
var optimalZoomX = parentRect.width / relWidth;
|
|
5005
|
-
var optimalZoomY = parentRect.height / relHeight;
|
|
5006
|
-
var _this_options_max;
|
|
5007
|
-
var newZoom = Math.min(optimalZoomX, optimalZoomY, (_this_options_max = _this.options.max) != null ? _this_options_max : 8);
|
|
5008
|
-
// Calculate new position to center the zone
|
|
5009
|
-
var rect = _this.container.getBoundingClientRect();
|
|
5010
|
-
var _ref = [
|
|
5011
|
-
rect.width / prevZoom / 2,
|
|
5012
|
-
rect.height / prevZoom / 2
|
|
5013
|
-
], centerX = _ref[0], centerY = _ref[1];
|
|
5014
|
-
var _ref1 = [
|
|
5015
|
-
relX + relWidth / 2,
|
|
5016
|
-
relY + relHeight / 2
|
|
5017
|
-
], zoneCenterX = _ref1[0], zoneCenterY = _ref1[1];
|
|
5018
|
-
newPosX = (centerX - zoneCenterX) * newZoom;
|
|
5019
|
-
newPosY = (centerY - zoneCenterY) * newZoom;
|
|
5020
|
-
_this.setZoom(newZoom);
|
|
5021
|
-
_this.setPos([
|
|
5022
|
-
newPosX,
|
|
5023
|
-
newPosY
|
|
5024
|
-
]);
|
|
5025
|
-
_this.setTransitionDuration(_this.options.animDuration);
|
|
5026
|
-
};
|
|
5027
|
-
this.getNewPosition = function(x, y, newZoom) {
|
|
5028
|
-
var _ref = [
|
|
5029
|
-
_this.zoom,
|
|
5030
|
-
_this.pos[0],
|
|
5031
|
-
_this.pos[1]
|
|
5032
|
-
], prevZoom = _ref[0];
|
|
5033
|
-
if (newZoom === 1 || !_this) return ZOOM_DEFAULT_POSITION;
|
|
5034
|
-
var _ref1 = [
|
|
5035
|
-
_this.container.clientWidth,
|
|
5036
|
-
_this.container.clientHeight
|
|
5037
|
-
], clientWidth = _ref1[0], clientHeight = _ref1[1];
|
|
5038
|
-
if (newZoom > prevZoom) {
|
|
5039
|
-
return [
|
|
5040
|
-
0,
|
|
5041
|
-
0
|
|
5042
|
-
];
|
|
5043
|
-
} else {
|
|
5044
|
-
// 放到最大
|
|
5045
|
-
var w = -((x - clientWidth / 2) / (clientWidth / 2)) * newZoom / 2;
|
|
5046
|
-
var h = -((y - clientHeight / 2) / (clientHeight / 2)) * newZoom / 2;
|
|
5047
|
-
if (w > newZoom / 2 - 0.5) {
|
|
5048
|
-
w = 3.5;
|
|
5049
|
-
}
|
|
5050
|
-
if (h > newZoom / 2 - 0.5) {
|
|
5051
|
-
h = 3.5;
|
|
5052
|
-
}
|
|
5053
|
-
return [
|
|
5054
|
-
clientWidth * w,
|
|
5055
|
-
clientHeight * h
|
|
5056
|
-
];
|
|
5057
|
-
}
|
|
5058
|
-
};
|
|
5059
|
-
/**
|
|
5060
|
-
* 缩放到最大
|
|
5061
|
-
* @param x - 点击点X坐标
|
|
5062
|
-
* @param y - 点击点Y坐标
|
|
5063
|
-
*/ this.fullZoomInOnPosition = function(x, y) {
|
|
5064
|
-
var _this_options_max;
|
|
5065
|
-
var zoom = (_this_options_max = _this.options.max) != null ? _this_options_max : DefaultOptions.max;
|
|
5066
|
-
_this.setZoom(zoom != null ? zoom : DefaultOptions.max);
|
|
5067
|
-
_this.setPos(_this.getNewPosition(x, y, zoom));
|
|
5068
|
-
_this.setTransitionDuration(_this.options.animDuration);
|
|
5069
|
-
};
|
|
5070
|
-
this.getLimitedShift = function(shift, minLimit, maxLimit, minElement, maxElement) {
|
|
5071
|
-
if (shift > 0) {
|
|
5072
|
-
if (minElement > minLimit) {
|
|
5073
|
-
return 0;
|
|
5074
|
-
} else if (minElement + shift > minLimit) {
|
|
5075
|
-
return minLimit - minElement;
|
|
5076
|
-
}
|
|
5077
|
-
} else if (shift < 0) {
|
|
5078
|
-
if (maxElement < maxLimit) {
|
|
5079
|
-
return 0;
|
|
5080
|
-
} else if (maxElement + shift < maxLimit) {
|
|
5081
|
-
return maxLimit - maxElement;
|
|
5082
|
-
}
|
|
5083
|
-
}
|
|
5084
|
-
return shift;
|
|
5085
|
-
};
|
|
5086
|
-
this.getCursor = function(canMoveOnX, canMoveOnY) {
|
|
5087
|
-
if (canMoveOnX && canMoveOnY) {
|
|
5088
|
-
return 'move';
|
|
5089
|
-
} else if (canMoveOnX) {
|
|
5090
|
-
return 'ew-resize';
|
|
5091
|
-
} else if (canMoveOnY) {
|
|
5092
|
-
return 'ns-resize';
|
|
5093
|
-
} else {
|
|
5094
|
-
return 'auto';
|
|
5095
|
-
}
|
|
5096
|
-
};
|
|
5097
|
-
this.move = function(shiftX, shiftY, transitionDuration) {
|
|
5098
|
-
if (transitionDuration === void 0) transitionDuration = 0;
|
|
5099
|
-
if (!_this.container) return;
|
|
5100
|
-
var newPosX = _this.pos[0];
|
|
5101
|
-
var newPosY = _this.pos[1];
|
|
5102
|
-
// let canMoveOnX: boolean, canMoveOnY: boolean;
|
|
5103
|
-
var rect = _this.container.getBoundingClientRect();
|
|
5104
|
-
var parentRect = _this.container.parentNode.getBoundingClientRect();
|
|
5105
|
-
// 根据是否进行了伪横屏旋转,决定是使用 shiftX 还是 shiftY 来对画面进行移动
|
|
5106
|
-
var shiftHorizontal = _this.transform ? shiftY : shiftX;
|
|
5107
|
-
var shiftVertical = _this.transform ? shiftX : shiftY;
|
|
5108
|
-
var _ref = _this.transform ? [
|
|
5109
|
-
rect.height > parentRect.bottom - parentRect.top,
|
|
5110
|
-
shiftVertical > 0 && rect.top - parentRect.top < 0,
|
|
5111
|
-
shiftVertical < 0 && rect.bottom - parentRect.bottom > 0
|
|
5112
|
-
] : [
|
|
5113
|
-
rect.width > parentRect.right - parentRect.left,
|
|
5114
|
-
shiftHorizontal > 0 && rect.left - parentRect.left < 0,
|
|
5115
|
-
shiftHorizontal < 0 && rect.right - parentRect.right > 0
|
|
5116
|
-
], isLargerHor = _ref[0], isOutLeftBoundary = _ref[1], isOutRightBoundary = _ref[2];
|
|
5117
|
-
var canMoveOnX = isLargerHor || isOutLeftBoundary || isOutRightBoundary;
|
|
5118
|
-
if (canMoveOnX) {
|
|
5119
|
-
if (_this.transform) {
|
|
5120
|
-
newPosX += _this.getLimitedShift(shiftVertical, parentRect.top, parentRect.bottom, rect.top, rect.bottom);
|
|
5121
|
-
} else {
|
|
5122
|
-
newPosX += _this.getLimitedShift(shiftHorizontal, parentRect.left, parentRect.right, rect.left, rect.right);
|
|
5123
|
-
}
|
|
5124
|
-
}
|
|
5125
|
-
var _ref1 = _this.transform ? [
|
|
5126
|
-
rect.width > parentRect.right - parentRect.left,
|
|
5127
|
-
shiftHorizontal > 0 && rect.right - parentRect.right < 0,
|
|
5128
|
-
shiftHorizontal < 0 && rect.left - parentRect.left > 0
|
|
5129
|
-
] : [
|
|
5130
|
-
rect.height > parentRect.bottom - parentRect.top,
|
|
5131
|
-
shiftVertical > 0 && rect.top - parentRect.top < 0,
|
|
5132
|
-
shiftVertical < 0 && rect.bottom - parentRect.bottom > 0
|
|
5133
|
-
], isLargerVer = _ref1[0], isOutTopBoundary = _ref1[1], isOutBottomBoundary = _ref1[2];
|
|
5134
|
-
var canMoveOnY = isLargerVer || isOutTopBoundary || isOutBottomBoundary;
|
|
5135
|
-
if (canMoveOnY) {
|
|
5136
|
-
if (_this.transform) {
|
|
5137
|
-
var transformGetLimitedShift = function(shift, minLimit, maxLimit, minElement, maxElement) {
|
|
5138
|
-
// css伪横屏边界判断特殊处理
|
|
5139
|
-
if (shift > 0) {
|
|
5140
|
-
if (maxElement < maxLimit + 1) {
|
|
5141
|
-
return 0;
|
|
5142
|
-
} else if (maxElement + shift < maxLimit + 1) {
|
|
5143
|
-
return maxLimit - maxElement;
|
|
5144
|
-
}
|
|
5145
|
-
} else if (shift < 0) {
|
|
5146
|
-
if (minElement + 1 > minLimit) {
|
|
5147
|
-
return 0;
|
|
5148
|
-
} else if (minElement + 1 + shift > minLimit) {
|
|
5149
|
-
return minLimit - minElement;
|
|
5150
|
-
}
|
|
5151
|
-
}
|
|
5152
|
-
return shift;
|
|
5153
|
-
};
|
|
5154
|
-
newPosY += transformGetLimitedShift(shiftHorizontal, parentRect.left, parentRect.right, rect.left, rect.right);
|
|
5155
|
-
} else {
|
|
5156
|
-
newPosY += _this.getLimitedShift(shiftVertical, parentRect.top, parentRect.bottom, rect.top, rect.bottom);
|
|
5157
|
-
}
|
|
5158
|
-
}
|
|
5159
|
-
var cursor = _this.getCursor(canMoveOnX, canMoveOnY);
|
|
5160
|
-
_this.setPos([
|
|
5161
|
-
newPosX,
|
|
5162
|
-
newPosY
|
|
5163
|
-
]);
|
|
5164
|
-
_this.setCursor(cursor);
|
|
5165
|
-
_this.setTransitionDuration(transitionDuration);
|
|
5166
|
-
};
|
|
5167
|
-
/**
|
|
5168
|
-
* 移动端双击
|
|
5169
|
-
* @returns
|
|
5170
|
-
*/ this.isDoubleTapping = function() {
|
|
5171
|
-
var touchTime = new Date().getTime();
|
|
5172
|
-
var _this_lastTouchTime, _this_options_doubleTouchMaxDelay, _this_lastDoubleTapTime, _this_options_doubleTouchMaxDelay1;
|
|
5173
|
-
var isDoubleTap = touchTime - ((_this_lastTouchTime = _this.lastTouchTime) != null ? _this_lastTouchTime : 0) < ((_this_options_doubleTouchMaxDelay = _this.options.doubleTouchMaxDelay) != null ? _this_options_doubleTouchMaxDelay : 300) && touchTime - ((_this_lastDoubleTapTime = _this.lastDoubleTapTime) != null ? _this_lastDoubleTapTime : 0) > ((_this_options_doubleTouchMaxDelay1 = _this.options.doubleTouchMaxDelay) != null ? _this_options_doubleTouchMaxDelay1 : 750);
|
|
5174
|
-
if (isDoubleTap) {
|
|
5175
|
-
_this.lastDoubleTapTime = touchTime;
|
|
5176
|
-
return true;
|
|
5177
|
-
}
|
|
5178
|
-
_this.lastTouchTime = touchTime;
|
|
5179
|
-
return false;
|
|
5180
|
-
};
|
|
5181
|
-
this.startDeceleration = function(lastShiftOnX, lastShiftOnY) {
|
|
5182
|
-
var startTimestamp = null;
|
|
5183
|
-
var startDecelerationMove = function(timestamp) {
|
|
5184
|
-
if (startTimestamp === null) startTimestamp = timestamp;
|
|
5185
|
-
var progress = timestamp - startTimestamp;
|
|
5186
|
-
var _this_options_decelerationDuration, _this_options_decelerationDuration1;
|
|
5187
|
-
var ratio = (((_this_options_decelerationDuration = _this.options.decelerationDuration) != null ? _this_options_decelerationDuration : 750) - progress) / ((_this_options_decelerationDuration1 = _this.options.decelerationDuration) != null ? _this_options_decelerationDuration1 : 750);
|
|
5188
|
-
var _ref = [
|
|
5189
|
-
lastShiftOnX * ratio,
|
|
5190
|
-
lastShiftOnY * ratio
|
|
5191
|
-
], shiftX = _ref[0], shiftY = _ref[1];
|
|
5192
|
-
var _this_options_decelerationDuration2;
|
|
5193
|
-
if (progress < ((_this_options_decelerationDuration2 = _this.options.decelerationDuration) != null ? _this_options_decelerationDuration2 : 750) && Math.max(Math.abs(shiftX), Math.abs(shiftY)) > 1) {
|
|
5194
|
-
_this.move(shiftX, shiftY, 0);
|
|
5195
|
-
_this.lastRequestAnimationId = requestAnimationFrame(startDecelerationMove);
|
|
5196
|
-
} else {
|
|
5197
|
-
_this.lastRequestAnimationId = null;
|
|
5198
|
-
}
|
|
5199
|
-
};
|
|
5200
|
-
_this.lastRequestAnimationId = requestAnimationFrame(startDecelerationMove);
|
|
5201
|
-
};
|
|
5202
|
-
this.reset = function() {
|
|
5203
|
-
_this.setZoom(_this.options.initialZoom, true);
|
|
5204
|
-
_this.cursor = _this.options.defaultCursor;
|
|
5205
|
-
_this.setTransitionDuration(_this.options.animDuration);
|
|
5206
|
-
_this.setPos(ZOOM_DEFAULT_POSITION);
|
|
5207
|
-
};
|
|
5208
|
-
// api向前兼容
|
|
5209
|
-
this.addScale = function(scale) {
|
|
5210
|
-
if (scale === void 0) scale = 1;
|
|
5211
|
-
_this.handleZoomAdd(scale);
|
|
5212
|
-
};
|
|
5213
|
-
this.handleZoomAdd = function(scale) {
|
|
5214
|
-
if (scale === void 0) scale = 1;
|
|
5215
|
-
if (!_this.options.allowZoom || !_this.options.allowWheel) return;
|
|
5216
|
-
var newZoom = parseFloat((_this.zoom + scale).toFixed(_this.getPrecision(_this.options.zoomStep)));
|
|
5217
|
-
var _this_options_max;
|
|
5218
|
-
if (newZoom > ((_this_options_max = _this.options.max) != null ? _this_options_max : 8)) {
|
|
5219
|
-
newZoom = 8;
|
|
5220
|
-
}
|
|
5221
|
-
_this.setZoom(newZoom);
|
|
5222
|
-
_this.setPos(_this.pos);
|
|
5223
|
-
_this.setTransitionDuration(0.05);
|
|
5224
|
-
};
|
|
5225
|
-
// api向前兼容
|
|
5226
|
-
this.subScale = function(scale) {
|
|
5227
|
-
if (scale === void 0) scale = 1;
|
|
5228
|
-
_this.handleZoomSub(scale);
|
|
5229
|
-
};
|
|
5230
|
-
this.handleZoomSub = function(scale) {
|
|
5231
|
-
if (scale === void 0) scale = 1;
|
|
5232
|
-
if (!_this.options.allowZoom || !_this.options.allowWheel) return;
|
|
5233
|
-
var newZoom = parseFloat((_this.zoom - scale).toFixed(_this.getPrecision(_this.options.zoomStep)));
|
|
5234
|
-
if (newZoom < 1) {
|
|
5235
|
-
newZoom = 1;
|
|
5236
|
-
}
|
|
5237
|
-
_this.setZoom(newZoom);
|
|
5238
|
-
_this.setPos(_this.pos);
|
|
5239
|
-
_this.setTransitionDuration(0.05);
|
|
5240
|
-
};
|
|
5241
|
-
this.handleMouseWheel = function(event) {
|
|
5242
|
-
event.preventDefault();
|
|
5243
|
-
if (!_this.options.allowZoom || !_this.options.allowWheel) return;
|
|
5244
|
-
var velocity = event.deltaY < 0 ? _this.options.scrollVelocity : 0 - _this.options.scrollVelocity;
|
|
5245
|
-
var _this_options_max, _this_options_min;
|
|
5246
|
-
var newZoom = parseFloat(Math.max(Math.min(_this.zoom + velocity, (_this_options_max = _this.options.max) != null ? _this_options_max : 8), (_this_options_min = _this.options.min) != null ? _this_options_min : 1).toFixed(_this.getPrecision(_this.options.zoomStep)));
|
|
5247
|
-
_this.setZoom(newZoom);
|
|
5248
|
-
// this.setPos(this.getNewPosition(posX, posY, newZoom));
|
|
5249
|
-
_this.setTransitionDuration(0.05);
|
|
5250
|
-
};
|
|
5251
|
-
this.handleMouseStart = function(event) {
|
|
5252
|
-
var _this_options_ignoredMouseButtons;
|
|
5253
|
-
event.preventDefault();
|
|
5254
|
-
if (!_this.options.allowPan || ((_this_options_ignoredMouseButtons = _this.options.ignoredMouseButtons) == null ? void 0 : _this_options_ignoredMouseButtons.includes(event.button))) return;
|
|
5255
|
-
_this._dragging = true;
|
|
5256
|
-
if (_this.lastRequestAnimationId) cancelAnimationFrame(_this.lastRequestAnimationId);
|
|
5257
|
-
_this.lastCursor = _this.getCoordinates(event);
|
|
5258
|
-
};
|
|
5259
|
-
this.handleMouseMove = function(event) {
|
|
5260
|
-
event.preventDefault();
|
|
5261
|
-
if (!_this.options.allowPan || !_this.lastCursor || !_this._dragging) return;
|
|
5262
|
-
_this._touchOrMouseDrag(event);
|
|
5263
|
-
};
|
|
5264
|
-
this.handleMouseStop = function(event) {
|
|
5265
|
-
event.preventDefault();
|
|
5266
|
-
if (_this.lastShift) {
|
|
5267
|
-
_this.startDeceleration(_this.lastShift[0], _this.lastShift[1]);
|
|
5268
|
-
_this.lastShift = null;
|
|
5269
|
-
}
|
|
5270
|
-
_this.lastCursor = null;
|
|
5271
|
-
_this.setCursor('auto');
|
|
5272
|
-
_this._dragging = false;
|
|
5273
|
-
};
|
|
5274
|
-
this.handleTouchStart = function(event) {
|
|
5275
|
-
var isThisDoubleTapping = _this.isDoubleTapping();
|
|
5276
|
-
_this.isMultiTouch = event.touches.length;
|
|
5277
|
-
if (!_this.options.allowTouchEvents) event.preventDefault();
|
|
5278
|
-
if (_this.lastRequestAnimationId) cancelAnimationFrame(_this.lastRequestAnimationId);
|
|
5279
|
-
var _this_getCoordinates = _this.getCoordinates(event.touches[0]), posX = _this_getCoordinates[0], posY = _this_getCoordinates[1];
|
|
5280
|
-
if (_this.isMultiTouch > 1) {
|
|
5281
|
-
_this.lastCursor = [
|
|
5282
|
-
posX,
|
|
5283
|
-
posY
|
|
5284
|
-
];
|
|
5285
|
-
return;
|
|
5286
|
-
}
|
|
5287
|
-
if (isThisDoubleTapping && _this.options.allowZoom) {
|
|
5288
|
-
if (_this.zoom === 1) {
|
|
5289
|
-
var _this_container_getBoundingClientRect = _this.container.getBoundingClientRect(); _this_container_getBoundingClientRect.top; _this_container_getBoundingClientRect.left; var x = _this_container_getBoundingClientRect.x, y = _this_container_getBoundingClientRect.y;
|
|
5290
|
-
var ref;
|
|
5291
|
-
ref = _this.transform ? [
|
|
5292
|
-
y,
|
|
5293
|
-
x
|
|
5294
|
-
] : [
|
|
5295
|
-
x,
|
|
5296
|
-
y
|
|
5297
|
-
], x = ref[0], y = ref[1];
|
|
5298
|
-
var ref1;
|
|
5299
|
-
ref1 = [
|
|
5300
|
-
posX - x,
|
|
5301
|
-
posY - y
|
|
5302
|
-
], posX = ref1[0], posY = ref1[1];
|
|
5303
|
-
// 双击放大到最大
|
|
5304
|
-
_this.fullZoomInOnPosition(posX, posY);
|
|
5305
|
-
} else {
|
|
5306
|
-
_this.reset();
|
|
5307
|
-
}
|
|
5308
|
-
return;
|
|
5309
|
-
}
|
|
5310
|
-
_this._tapStartTime = new Date().getTime();
|
|
5311
|
-
if (_this.options.allowPan) _this.lastCursor = [
|
|
5312
|
-
posX,
|
|
5313
|
-
posY
|
|
5314
|
-
];
|
|
5315
|
-
};
|
|
5316
|
-
this.handleTouchMove = function(event) {
|
|
5317
|
-
if (!_this.options.allowTouchEvents) event.preventDefault();
|
|
5318
|
-
if (!_this.lastCursor) return;
|
|
5319
|
-
if (_this.isMultiTouch === 1) {
|
|
5320
|
-
_this._touchOrMouseDrag(event.touches[0]);
|
|
5321
|
-
_this.lastTouchDistance = null;
|
|
5322
|
-
} else if (_this.isMultiTouch > 1) {
|
|
5323
|
-
var newZoom = _this.zoom;
|
|
5324
|
-
// If we detect two points, we shall zoom up or down
|
|
5325
|
-
var _this_getCoordinates = _this.getCoordinates(event.touches[0]), pos1X = _this_getCoordinates[0], pos1Y = _this_getCoordinates[1];
|
|
5326
|
-
var _this_getCoordinates1 = _this.getCoordinates(event.touches[1]), pos2X = _this_getCoordinates1[0], pos2Y = _this_getCoordinates1[1];
|
|
5327
|
-
var distance = Math.sqrt(Math.pow(pos2X - pos1X, 2) + Math.pow(pos2Y - pos1Y, 2));
|
|
5328
|
-
if (_this.lastTouchDistance && distance && distance !== _this.lastTouchDistance) {
|
|
5329
|
-
if (_this.options.allowZoom) {
|
|
5330
|
-
newZoom += (distance - _this.lastTouchDistance) / 100;
|
|
5331
|
-
var _this_options_max, _this_options_min;
|
|
5332
|
-
if (newZoom > ((_this_options_max = _this.options.max) != null ? _this_options_max : 8)) {
|
|
5333
|
-
var _this_options_max1;
|
|
5334
|
-
newZoom = (_this_options_max1 = _this.options.max) != null ? _this_options_max1 : 8;
|
|
5335
|
-
} else if (newZoom < ((_this_options_min = _this.options.min) != null ? _this_options_min : 1)) {
|
|
5336
|
-
var _this_options_min1;
|
|
5337
|
-
newZoom = (_this_options_min1 = _this.options.min) != null ? _this_options_min1 : 1;
|
|
5338
|
-
}
|
|
5339
|
-
}
|
|
5340
|
-
// 不要做移动,因为会有冲突
|
|
5341
|
-
_this.setZoom(newZoom);
|
|
5342
|
-
_this.setTransitionDuration(0);
|
|
5343
|
-
}
|
|
5344
|
-
// Save data for the next move
|
|
5345
|
-
_this.lastCursor = [
|
|
5346
|
-
pos1X,
|
|
5347
|
-
pos1Y
|
|
5348
|
-
];
|
|
5349
|
-
_this.lastTouchDistance = distance;
|
|
5350
|
-
}
|
|
5351
|
-
};
|
|
5352
|
-
this.handleTouchStop = function() {
|
|
5353
|
-
if (_this.lastShift) {
|
|
5354
|
-
// Use the last shift to make a decelerating movement effect
|
|
5355
|
-
_this.startDeceleration(_this.lastShift[0], _this.lastShift[1]);
|
|
5356
|
-
_this.lastShift = null;
|
|
5357
|
-
}
|
|
5358
|
-
if (_this._tapStartTime && new Date().getTime() - _this._tapStartTime < 200) {
|
|
5359
|
-
_this.options.onTap == null ? void 0 : _this.options.onTap.call(_this.options);
|
|
5360
|
-
}
|
|
5361
|
-
_this._tapStartTime = undefined;
|
|
5362
|
-
_this.lastCursor = null;
|
|
5363
|
-
_this.lastTouchDistance = null;
|
|
5364
|
-
_this.isMultiTouch = 0;
|
|
5365
|
-
};
|
|
5366
|
-
this.container = container;
|
|
5367
|
-
this.options = Object.assign({}, DefaultOptions, options || {});
|
|
5368
|
-
this.percentPos = ZOOM_DEFAULT_POSITION;
|
|
5369
|
-
this.transition = this.options.animDuration;
|
|
5370
|
-
this.zoom = 1;
|
|
5371
|
-
this.cursor = 'auto';
|
|
5372
|
-
this.lastCursor = [
|
|
5373
|
-
0,
|
|
5374
|
-
0
|
|
5375
|
-
];
|
|
5376
|
-
this.lastShift = null;
|
|
5377
|
-
this.lastTouchDistance = null;
|
|
5378
|
-
this.lastRequestAnimationId = null;
|
|
5379
|
-
this.lastTouchTime = new Date().getTime();
|
|
5380
|
-
this.lastDoubleTapTime = new Date().getTime();
|
|
5381
|
-
this.transform = false; // 是否为横屏模式
|
|
5382
|
-
this.isMultiTouch = 1;
|
|
5383
|
-
this.handleMouseMove = this.handleMouseMove.bind(this);
|
|
5384
|
-
this.handleMouseStart = this.handleMouseStart.bind(this);
|
|
5385
|
-
this.handleMouseStop = this.handleMouseStop.bind(this);
|
|
5386
|
-
this.handleMouseWheel = this.handleMouseWheel.bind(this);
|
|
5387
|
-
this.handleTouchStart = this.handleTouchStart.bind(this);
|
|
5388
|
-
this.handleTouchMove = this.handleTouchMove.bind(this);
|
|
5389
|
-
this.handleTouchStop = this.handleTouchStop.bind(this);
|
|
5390
|
-
this.getZoom = this.getZoom.bind(this);
|
|
5391
|
-
this.setZoom = this.setZoom.bind(this);
|
|
5392
|
-
}
|
|
5393
|
-
var _proto = Zoom.prototype;
|
|
5394
|
-
// 设置事件侦听器
|
|
5395
|
-
_proto.setUpEventListeners = function setUpEventListeners() {
|
|
5396
|
-
var refCurrentValue = this.container;
|
|
5397
|
-
var hasMouseDevice = window.matchMedia('(pointer: fine)').matches;
|
|
5398
|
-
if (hasMouseDevice) {
|
|
5399
|
-
if (this.options.allowWheel) {
|
|
5400
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('wheel', this.handleMouseWheel, {
|
|
5401
|
-
passive: false
|
|
5402
|
-
});
|
|
5403
|
-
}
|
|
5404
|
-
// Apply mouse events only to devices which include an accurate pointing device
|
|
5405
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mousedown', this.handleMouseStart, {
|
|
5406
|
-
passive: false
|
|
5407
|
-
});
|
|
5408
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mousemove', this.handleMouseMove, {
|
|
5409
|
-
passive: false
|
|
5410
|
-
});
|
|
5411
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mouseup', this.handleMouseStop, {
|
|
5412
|
-
passive: false
|
|
5413
|
-
});
|
|
5414
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('mouseleave', this.handleMouseStop, {
|
|
5415
|
-
passive: false
|
|
5416
|
-
});
|
|
5417
|
-
} else {
|
|
5418
|
-
// Apply touch events to all other devices
|
|
5419
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchstart', this.handleTouchStart, {
|
|
5420
|
-
passive: false
|
|
5421
|
-
});
|
|
5422
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchmove', this.handleTouchMove, {
|
|
5423
|
-
passive: false
|
|
5424
|
-
});
|
|
5425
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchend', this.handleTouchStop, {
|
|
5426
|
-
passive: false
|
|
5427
|
-
});
|
|
5428
|
-
refCurrentValue == null ? void 0 : refCurrentValue.addEventListener('touchcancel', this.handleTouchStop, {
|
|
5429
|
-
passive: false
|
|
5430
|
-
});
|
|
5431
|
-
}
|
|
5432
|
-
};
|
|
5433
|
-
// 移除事件侦听器
|
|
5434
|
-
_proto.removeEventListeners = function removeEventListeners() {
|
|
5435
|
-
var refCurrentValue = this.container;
|
|
5436
|
-
var hasMouseDevice = window.matchMedia('(pointer: fine)').matches;
|
|
5437
|
-
if (hasMouseDevice) {
|
|
5438
|
-
if (this.options.allowWheel) {
|
|
5439
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('wheel', this.handleMouseWheel);
|
|
5440
|
-
}
|
|
5441
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mousedown', this.handleMouseStart);
|
|
5442
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mousemove', this.handleMouseMove);
|
|
5443
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mouseup', this.handleMouseStop);
|
|
5444
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('mouseleave', this.handleMouseStop);
|
|
5445
|
-
} else {
|
|
5446
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchstart', this.handleTouchStart);
|
|
5447
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchmove', this.handleTouchMove);
|
|
5448
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchend', this.handleTouchStop);
|
|
5449
|
-
refCurrentValue == null ? void 0 : refCurrentValue.removeEventListener('touchcancel', this.handleTouchStop);
|
|
5450
|
-
}
|
|
5451
|
-
};
|
|
5452
|
-
_proto.getPrecision = function getPrecision(value) {
|
|
5453
|
-
if (value === void 0) value = 1;
|
|
5454
|
-
var valueStr = value.toString();
|
|
5455
|
-
if (valueStr.includes('.')) {
|
|
5456
|
-
return valueStr.split('.')[1].length;
|
|
5457
|
-
} else {
|
|
5458
|
-
return 1;
|
|
5459
|
-
}
|
|
5460
|
-
};
|
|
5461
|
-
/**
|
|
5462
|
-
* 获取坐标 (伪横屏X、Y轴坐标转换, 相对值)
|
|
5463
|
-
* @param event
|
|
5464
|
-
* @returns
|
|
5465
|
-
*/ _proto.getCoordinates = function getCoordinates(event) {
|
|
5466
|
-
var clientHeight = this.container.clientHeight;
|
|
5467
|
-
var clientTop = this.container.clientTop;
|
|
5468
|
-
var clientLeft = this.container.clientLeft;
|
|
5469
|
-
var _ref = this.transform ? [
|
|
5470
|
-
event.clientY,
|
|
5471
|
-
clientHeight - event.clientX
|
|
5472
|
-
] : [
|
|
5473
|
-
event.clientX - clientTop,
|
|
5474
|
-
event.clientY - clientLeft
|
|
5475
|
-
], x1 = _ref[0], y1 = _ref[1];
|
|
5476
|
-
return [
|
|
5477
|
-
x1,
|
|
5478
|
-
y1
|
|
5479
|
-
];
|
|
5480
|
-
};
|
|
5481
|
-
_proto._touchOrMouseDrag = function _touchOrMouseDrag(event) {
|
|
5482
|
-
if (this.lastCursor) {
|
|
5483
|
-
var _this_getCoordinates = this.getCoordinates(event), posX = _this_getCoordinates[0], posY = _this_getCoordinates[1];
|
|
5484
|
-
var shiftX = posX - this.lastCursor[0];
|
|
5485
|
-
var shiftY = posY - this.lastCursor[1];
|
|
5486
|
-
this.move(shiftX, shiftY, 0);
|
|
5487
|
-
this.lastCursor = [
|
|
5488
|
-
posX,
|
|
5489
|
-
posY
|
|
5490
|
-
];
|
|
5491
|
-
this.lastShift = [
|
|
5492
|
-
shiftX,
|
|
5493
|
-
shiftY
|
|
5494
|
-
];
|
|
5495
|
-
}
|
|
5496
|
-
};
|
|
5497
|
-
_create_class(Zoom, [
|
|
5498
|
-
{
|
|
5499
|
-
key: "pos",
|
|
5500
|
-
get: function get() {
|
|
5501
|
-
return [
|
|
5502
|
-
this.container.clientWidth * this.percentPos[0],
|
|
5503
|
-
this.container.clientHeight * this.percentPos[1]
|
|
5504
|
-
];
|
|
5505
|
-
}
|
|
5506
|
-
}
|
|
5507
|
-
]);
|
|
5508
|
-
return Zoom;
|
|
5509
|
-
}();
|
|
5510
|
-
Zoom.VERSION = '0.0.2';
|
|
5511
|
-
|
|
5512
|
-
dist$1 = Zoom;
|
|
5513
|
-
return dist$1;
|
|
5514
|
-
}
|
|
5515
|
-
|
|
5516
|
-
var distExports$1 = requireDist$1();
|
|
5517
|
-
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
|
|
5518
|
-
|
|
5519
4785
|
function _extends$j() {
|
|
5520
4786
|
_extends$j = Object.assign || function(target) {
|
|
5521
4787
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -5531,7 +4797,7 @@ function _extends$j() {
|
|
|
5531
4797
|
return _extends$j.apply(this, arguments);
|
|
5532
4798
|
}
|
|
5533
4799
|
function __zoom(theme, container, options) {
|
|
5534
|
-
theme.zoomUtil = new Zoom(container, _extends$j({}, options || {}, {
|
|
4800
|
+
theme.zoomUtil = new Zoom$1(container, _extends$j({}, options || {}, {
|
|
5535
4801
|
min: 1,
|
|
5536
4802
|
onChange: function(zoom, reset) {
|
|
5537
4803
|
if (zoom !== theme._zoom) {
|
|
@@ -5894,7 +5160,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
5894
5160
|
deviceControls.push(item);
|
|
5895
5161
|
return false;
|
|
5896
5162
|
}
|
|
5897
|
-
if (item.isrender !== 0 && REC_GROUP
|
|
5163
|
+
if (item.isrender !== 0 && REC_GROUP.includes(item.iconId)) {
|
|
5898
5164
|
// TODO: 因为回放是一组, 位置以第一个位置为准
|
|
5899
5165
|
recControls.push(recControls[0] ? _extends$i({}, item, {
|
|
5900
5166
|
part: recControls[0].part
|
|
@@ -5917,7 +5183,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
5917
5183
|
deviceControls.push(item);
|
|
5918
5184
|
return false;
|
|
5919
5185
|
}
|
|
5920
|
-
if (item.isrender !== 0 && REC_GROUP
|
|
5186
|
+
if (item.isrender !== 0 && REC_GROUP.includes(item.iconId)) {
|
|
5921
5187
|
// TODO: 因为回放是一组, 位置以第一个位置为准
|
|
5922
5188
|
recControls.push(recControls[0] ? _extends$i({}, item, {
|
|
5923
5189
|
part: recControls[0].part
|
|
@@ -6585,949 +5851,6 @@ function _set_prototype_of$f(o, p) {
|
|
|
6585
5851
|
return CapturePicture;
|
|
6586
5852
|
}(Control);
|
|
6587
5853
|
|
|
6588
|
-
var dist = {};
|
|
6589
|
-
|
|
6590
|
-
/*
|
|
6591
|
-
* @ezuikit/control-ptz v0.0.1
|
|
6592
|
-
* Copyright (c) 2026-04-02 Ezviz-OpenBiz
|
|
6593
|
-
* Released under the MIT License.
|
|
6594
|
-
*/
|
|
6595
|
-
|
|
6596
|
-
var hasRequiredDist;
|
|
6597
|
-
|
|
6598
|
-
function requireDist () {
|
|
6599
|
-
if (hasRequiredDist) return dist;
|
|
6600
|
-
hasRequiredDist = 1;
|
|
6601
|
-
|
|
6602
|
-
var deepmerge$1 = deepmerge;
|
|
6603
|
-
var utilsTools = require$$1;
|
|
6604
|
-
|
|
6605
|
-
var en_US = {
|
|
6606
|
-
GET_PTZ_STATUS: 'Get current PTZ status',
|
|
6607
|
-
GET_PTZ_STATUS_FAILED: 'Theme module is not loaded, PTZ status cannot be obtained',
|
|
6608
|
-
MOBILE_HIDE_PTZ: 'Mobile terminal, PTZ is not displayed in non-full screen state',
|
|
6609
|
-
OPTION_PTZ_FAILED: 'Theme module is not loaded, PTZ cannot be operated',
|
|
6610
|
-
MOBILE_PTZ_TIPS: 'Adjust camera angle by manipulating gimbal',
|
|
6611
|
-
PTZ_FAST: 'F',
|
|
6612
|
-
PTZ_MID: 'M',
|
|
6613
|
-
PTZ_SLOW: 'S',
|
|
6614
|
-
PTZ_SPEED: 'Adjust the PTZ rotation speed',
|
|
6615
|
-
DEVICE_ZOOM: 'Control the device to zoom in/out of the screen',
|
|
6616
|
-
DEVICE_FOCUS: "Adjusting the device's focal length"
|
|
6617
|
-
};
|
|
6618
|
-
|
|
6619
|
-
var zh_CN = {
|
|
6620
|
-
GET_PTZ_STATUS: '获取当前云台状态',
|
|
6621
|
-
GET_PTZ_STATUS_FAILED: '未加载Theme模块,无法获取云台状态',
|
|
6622
|
-
MOBILE_HIDE_PTZ: '移动端,非全屏状态不展示云台',
|
|
6623
|
-
OPTION_PTZ_FAILED: '未加载Theme模块,无法操作云台',
|
|
6624
|
-
MOBILE_PTZ_TIPS: '请通过操控云台来调整摄像机视角',
|
|
6625
|
-
PTZ_FAST: '快',
|
|
6626
|
-
PTZ_MID: '中',
|
|
6627
|
-
PTZ_SLOW: '慢',
|
|
6628
|
-
PTZ_SPEED: '调整云台转动速度',
|
|
6629
|
-
DEVICE_ZOOM: '控制设备放大/缩小画面',
|
|
6630
|
-
DEVICE_FOCUS: '调整设备焦距'
|
|
6631
|
-
};
|
|
6632
|
-
|
|
6633
|
-
var PTZ_DEFAULT_OPTIONS = {
|
|
6634
|
-
language: 'zh',
|
|
6635
|
-
env: {
|
|
6636
|
-
domain: 'https://open.ys7.com'
|
|
6637
|
-
},
|
|
6638
|
-
accessToken: '',
|
|
6639
|
-
speed: 2,
|
|
6640
|
-
locales: {
|
|
6641
|
-
zh: zh_CN,
|
|
6642
|
-
en: en_US
|
|
6643
|
-
}
|
|
6644
|
-
};
|
|
6645
|
-
var PTZ_SPEED = {
|
|
6646
|
-
1: 1,
|
|
6647
|
-
2: 3,
|
|
6648
|
-
3: 7,
|
|
6649
|
-
slow: 1,
|
|
6650
|
-
mid: 3,
|
|
6651
|
-
fast: 7
|
|
6652
|
-
};
|
|
6653
|
-
var PTZ_PREFIX = 'ez-ptz';
|
|
6654
|
-
var PTZ_MOBILE_PREFIX = 'ez-mobile-ptz';
|
|
6655
|
-
var PTZ_SPEED_ACTIVE_PREFIX = PTZ_PREFIX + '-speed-active';
|
|
6656
|
-
var PTZ_DIRECTION_PREFIX = PTZ_PREFIX + '-direction';
|
|
6657
|
-
|
|
6658
|
-
var BasePtz = /*#__PURE__*/ function() {
|
|
6659
|
-
function BasePtz(container, options) {
|
|
6660
|
-
if (options === void 0) options = {};
|
|
6661
|
-
var _this_options_locales;
|
|
6662
|
-
if (!container) throw new Error('Ptz container is required');
|
|
6663
|
-
this.options = deepmerge$1(PTZ_DEFAULT_OPTIONS, options, {
|
|
6664
|
-
clone: false
|
|
6665
|
-
});
|
|
6666
|
-
if ((_this_options_locales = this.options.locales) == null ? void 0 : _this_options_locales[this.options.language]) {
|
|
6667
|
-
var _this_options_locales1;
|
|
6668
|
-
this.locale = (_this_options_locales1 = this.options.locales) == null ? void 0 : _this_options_locales1[this.options.language];
|
|
6669
|
-
} else {
|
|
6670
|
-
var _this_options_locales2;
|
|
6671
|
-
this.locale = (_this_options_locales2 = this.options.locales) == null ? void 0 : _this_options_locales2['zh'];
|
|
6672
|
-
}
|
|
6673
|
-
this.$container = container;
|
|
6674
|
-
this.speed = PTZ_SPEED[this.options.speed || 2];
|
|
6675
|
-
}
|
|
6676
|
-
var _proto = BasePtz.prototype;
|
|
6677
|
-
_proto.updateOptions = function updateOptions(options) {
|
|
6678
|
-
this.options = deepmerge$1(this.options, options, {
|
|
6679
|
-
clone: false
|
|
6680
|
-
});
|
|
6681
|
-
};
|
|
6682
|
-
_proto.destroy = function destroy() {};
|
|
6683
|
-
return BasePtz;
|
|
6684
|
-
}();
|
|
6685
|
-
|
|
6686
|
-
function _inherits$1(subClass, superClass) {
|
|
6687
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
6688
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
6689
|
-
}
|
|
6690
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
6691
|
-
constructor: {
|
|
6692
|
-
value: subClass,
|
|
6693
|
-
writable: true,
|
|
6694
|
-
configurable: true
|
|
6695
|
-
}
|
|
6696
|
-
});
|
|
6697
|
-
if (superClass) _set_prototype_of$1(subClass, superClass);
|
|
6698
|
-
}
|
|
6699
|
-
function _set_prototype_of$1(o, p) {
|
|
6700
|
-
_set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
6701
|
-
o.__proto__ = p;
|
|
6702
|
-
return o;
|
|
6703
|
-
};
|
|
6704
|
-
return _set_prototype_of$1(o, p);
|
|
6705
|
-
}
|
|
6706
|
-
var MobilePtz = /*#__PURE__*/ function(BasePtz) {
|
|
6707
|
-
_inherits$1(MobilePtz, BasePtz);
|
|
6708
|
-
function MobilePtz(container, options) {
|
|
6709
|
-
var _this;
|
|
6710
|
-
_this = BasePtz.call(this, container, options) || this;
|
|
6711
|
-
_this._touchstart = _this._touchstart.bind(_this);
|
|
6712
|
-
_this._touchend = _this._touchend.bind(_this);
|
|
6713
|
-
_this._render();
|
|
6714
|
-
return _this;
|
|
6715
|
-
}
|
|
6716
|
-
var _proto = MobilePtz.prototype;
|
|
6717
|
-
_proto.destroy = function destroy() {
|
|
6718
|
-
this._removeEventListener();
|
|
6719
|
-
if (this.$content) {
|
|
6720
|
-
this.$content.remove();
|
|
6721
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6722
|
-
this.$content = null;
|
|
6723
|
-
}
|
|
6724
|
-
BasePtz.prototype.destroy.call(this);
|
|
6725
|
-
};
|
|
6726
|
-
_proto._render = function _render() {
|
|
6727
|
-
this.$content = document.createElement('div');
|
|
6728
|
-
this.$content.classList.add(PTZ_MOBILE_PREFIX + '-content');
|
|
6729
|
-
this.$content.innerHTML = '\n <div class="' + PTZ_MOBILE_PREFIX + '-wrap">\n <div class="' + PTZ_MOBILE_PREFIX + '-container">\n <div class="' + PTZ_MOBILE_PREFIX + "-center " + PTZ_MOBILE_PREFIX + '-center"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-top " + PTZ_MOBILE_PREFIX + '-default"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-left " + PTZ_MOBILE_PREFIX + '-default"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-bottom " + PTZ_MOBILE_PREFIX + '-default"></div>\n <div class="' + PTZ_MOBILE_PREFIX + "-icon " + PTZ_MOBILE_PREFIX + "-right " + PTZ_MOBILE_PREFIX + '-default"></div>\n </div>\n </div>\n ';
|
|
6730
|
-
this.$container.appendChild(this.$content);
|
|
6731
|
-
this._addEventListener();
|
|
6732
|
-
};
|
|
6733
|
-
_proto._addEventListener = function _addEventListener() {
|
|
6734
|
-
// 云台控制事件绑定
|
|
6735
|
-
var $warp = this.$content.querySelector("." + PTZ_MOBILE_PREFIX + "-wrap");
|
|
6736
|
-
var touchstart = 'PointerEvent' in window ? 'pointerdown' : 'touchstart';
|
|
6737
|
-
var touchend = 'PointerEvent' in window ? 'pointerup' : 'touchend';
|
|
6738
|
-
if ($warp) {
|
|
6739
|
-
$warp.addEventListener(touchstart, this._touchstart);
|
|
6740
|
-
$warp.addEventListener(touchend, this._touchend);
|
|
6741
|
-
}
|
|
6742
|
-
};
|
|
6743
|
-
_proto._touchstart = function _touchstart(e) {
|
|
6744
|
-
e.preventDefault();
|
|
6745
|
-
this._handlePtzTouch(e, 'start');
|
|
6746
|
-
};
|
|
6747
|
-
_proto._touchend = function _touchend(e) {
|
|
6748
|
-
e.preventDefault();
|
|
6749
|
-
this._handlePtzTouch(e, 'stop');
|
|
6750
|
-
};
|
|
6751
|
-
_proto._removeEventListener = function _removeEventListener() {
|
|
6752
|
-
var $warp = this.$content.querySelector("." + PTZ_MOBILE_PREFIX + "-wrap");
|
|
6753
|
-
var touchstart = 'PointerEvent' in window ? 'pointerdown' : 'touchstart';
|
|
6754
|
-
var touchend = 'PointerEvent' in window ? 'pointerup' : 'touchend';
|
|
6755
|
-
if ($warp) {
|
|
6756
|
-
$warp.removeEventListener(touchstart, this._touchstart);
|
|
6757
|
-
$warp.removeEventListener(touchend, this._touchend);
|
|
6758
|
-
}
|
|
6759
|
-
};
|
|
6760
|
-
_proto._handlePtzTouch = function _handlePtzTouch(e, type) {
|
|
6761
|
-
var _this_options_token_deviceToken, _this_options_token, _e_changedTouches_, _e_changedTouches_1, _this_options_env, _this_options_token_deviceToken1, _this_options_token1;
|
|
6762
|
-
if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
|
|
6763
|
-
var $warp = this.$content.querySelector("." + PTZ_MOBILE_PREFIX + "-wrap");
|
|
6764
|
-
var rect = $warp.getBoundingClientRect();
|
|
6765
|
-
var containerCenterX = rect.left + 130;
|
|
6766
|
-
var containerCenterY = rect.top + 130;
|
|
6767
|
-
var eventX = e.x || ((_e_changedTouches_ = e.changedTouches[0]) == null ? void 0 : _e_changedTouches_.clientX);
|
|
6768
|
-
var eventY = e.y || ((_e_changedTouches_1 = e.changedTouches[0]) == null ? void 0 : _e_changedTouches_1.clientY);
|
|
6769
|
-
var left = eventX - containerCenterX;
|
|
6770
|
-
var top = eventY - containerCenterY;
|
|
6771
|
-
var direction = 0; // 操作命令:0-上,1-下,2-左,3右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距
|
|
6772
|
-
var url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
|
|
6773
|
-
var token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken1 = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken1.video);
|
|
6774
|
-
var $icons = $warp.querySelectorAll("." + PTZ_MOBILE_PREFIX + "-icon");
|
|
6775
|
-
// 判读方位
|
|
6776
|
-
if (Math.abs(left) > Math.abs(top)) {
|
|
6777
|
-
if (left > 0) {
|
|
6778
|
-
direction = 3;
|
|
6779
|
-
$icons[3].className = $icons[3].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
|
|
6780
|
-
} else {
|
|
6781
|
-
direction = 2;
|
|
6782
|
-
$icons[1].className = $icons[1].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
|
|
6783
|
-
}
|
|
6784
|
-
} else {
|
|
6785
|
-
if (top > 0) {
|
|
6786
|
-
direction = 1;
|
|
6787
|
-
$icons[2].className = $icons[2].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
|
|
6788
|
-
} else {
|
|
6789
|
-
direction = 0;
|
|
6790
|
-
$icons[0].className = $icons[0].className.replace("" + PTZ_MOBILE_PREFIX + "-default", "" + PTZ_MOBILE_PREFIX + "-active");
|
|
6791
|
-
}
|
|
6792
|
-
}
|
|
6793
|
-
$warp.style.cssText = "background-image:linear-gradient(" + (direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270) + "deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)";
|
|
6794
|
-
if (type === 'stop') {
|
|
6795
|
-
var _this_options_env1;
|
|
6796
|
-
url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
|
|
6797
|
-
$warp.style.cssText = '';
|
|
6798
|
-
$icons[3].className = $icons[3].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
|
|
6799
|
-
$icons[1].className = $icons[1].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
|
|
6800
|
-
$icons[2].className = $icons[2].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
|
|
6801
|
-
$icons[0].className = $icons[0].className.replace("" + PTZ_MOBILE_PREFIX + "-active", "" + PTZ_MOBILE_PREFIX + "-default");
|
|
6802
|
-
}
|
|
6803
|
-
// 这个控件暂时没有 ptzSpeed 和areaId 和backDeg 的值
|
|
6804
|
-
// this.jSPlugin?.eventEmitter?.emit(EVENTS.ptz.ptzDirection, {
|
|
6805
|
-
// type,
|
|
6806
|
-
// direction,
|
|
6807
|
-
// isRotate: false,
|
|
6808
|
-
// ptzSpeed: 1,
|
|
6809
|
-
// });
|
|
6810
|
-
var operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
|
|
6811
|
-
direction: direction,
|
|
6812
|
-
speed: this.speed,
|
|
6813
|
-
type: type
|
|
6814
|
-
});
|
|
6815
|
-
var data = new FormData();
|
|
6816
|
-
data.append('deviceSerial', this.options.deviceSerial + '');
|
|
6817
|
-
data.append('channelNo', this.options.channelNo + '');
|
|
6818
|
-
data.append('speed', '1');
|
|
6819
|
-
data.append('direction', direction + '');
|
|
6820
|
-
data.append('accessToken', token);
|
|
6821
|
-
// prettier-ignore
|
|
6822
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
6823
|
-
fetch(url, {
|
|
6824
|
-
method: 'POST',
|
|
6825
|
-
body: data
|
|
6826
|
-
}).then(function(response) {
|
|
6827
|
-
return response.json();
|
|
6828
|
-
}).then(function(rt) {
|
|
6829
|
-
if (rt.code === 200) ; else {
|
|
6830
|
-
// this.jSPlugin?.logger?.error('[errors]', this.jSPlugin.i18n.t('38' + rt.code) + `(${rt.code})`);
|
|
6831
|
-
// const msg = this.jSPlugin.i18n.t('38' + rt.code) || rt.msg;
|
|
6832
|
-
// this.pluginStatus.loadingSetText({
|
|
6833
|
-
// text: msg,
|
|
6834
|
-
// color: 'red',
|
|
6835
|
-
// delayClear: 2000,
|
|
6836
|
-
// });
|
|
6837
|
-
if ([
|
|
6838
|
-
60005,
|
|
6839
|
-
60002,
|
|
6840
|
-
60003,
|
|
6841
|
-
60004
|
|
6842
|
-
].includes(+rt.code)) {
|
|
6843
|
-
$warp.style.cssText = "background-image:linear-gradient(" + (direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270) + "deg, #f45656 0%, rgba(100,143,252,0.00) 50%)";
|
|
6844
|
-
}
|
|
6845
|
-
}
|
|
6846
|
-
operationResultCb == null ? void 0 : operationResultCb(rt);
|
|
6847
|
-
}).catch(function(err) {
|
|
6848
|
-
}).finally(function() {
|
|
6849
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6850
|
-
operationResultCb = null;
|
|
6851
|
-
});
|
|
6852
|
-
};
|
|
6853
|
-
return MobilePtz;
|
|
6854
|
-
}(BasePtz);
|
|
6855
|
-
|
|
6856
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
6857
|
-
try {
|
|
6858
|
-
var info = gen[key](arg);
|
|
6859
|
-
var value = info.value;
|
|
6860
|
-
} catch (error) {
|
|
6861
|
-
reject(error);
|
|
6862
|
-
return;
|
|
6863
|
-
}
|
|
6864
|
-
if (info.done) {
|
|
6865
|
-
resolve(value);
|
|
6866
|
-
} else {
|
|
6867
|
-
Promise.resolve(value).then(_next, _throw);
|
|
6868
|
-
}
|
|
6869
|
-
}
|
|
6870
|
-
function _async_to_generator(fn) {
|
|
6871
|
-
return function() {
|
|
6872
|
-
var self = this, args = arguments;
|
|
6873
|
-
return new Promise(function(resolve, reject) {
|
|
6874
|
-
var gen = fn.apply(self, args);
|
|
6875
|
-
function _next(value) {
|
|
6876
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
6877
|
-
}
|
|
6878
|
-
function _throw(err) {
|
|
6879
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
6880
|
-
}
|
|
6881
|
-
_next(undefined);
|
|
6882
|
-
});
|
|
6883
|
-
};
|
|
6884
|
-
}
|
|
6885
|
-
function _defineProperties(target, props) {
|
|
6886
|
-
for(var i = 0; i < props.length; i++){
|
|
6887
|
-
var descriptor = props[i];
|
|
6888
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
6889
|
-
descriptor.configurable = true;
|
|
6890
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
6891
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
6892
|
-
}
|
|
6893
|
-
}
|
|
6894
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
6895
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
6896
|
-
return Constructor;
|
|
6897
|
-
}
|
|
6898
|
-
function _inherits(subClass, superClass) {
|
|
6899
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
6900
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
6901
|
-
}
|
|
6902
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
6903
|
-
constructor: {
|
|
6904
|
-
value: subClass,
|
|
6905
|
-
writable: true,
|
|
6906
|
-
configurable: true
|
|
6907
|
-
}
|
|
6908
|
-
});
|
|
6909
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
6910
|
-
}
|
|
6911
|
-
function _set_prototype_of(o, p) {
|
|
6912
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
6913
|
-
o.__proto__ = p;
|
|
6914
|
-
return o;
|
|
6915
|
-
};
|
|
6916
|
-
return _set_prototype_of(o, p);
|
|
6917
|
-
}
|
|
6918
|
-
function _ts_generator(thisArg, body) {
|
|
6919
|
-
var f, y, t, _ = {
|
|
6920
|
-
label: 0,
|
|
6921
|
-
sent: function() {
|
|
6922
|
-
if (t[0] & 1) throw t[1];
|
|
6923
|
-
return t[1];
|
|
6924
|
-
},
|
|
6925
|
-
trys: [],
|
|
6926
|
-
ops: []
|
|
6927
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
6928
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
6929
|
-
return this;
|
|
6930
|
-
}), g;
|
|
6931
|
-
function verb(n) {
|
|
6932
|
-
return function(v) {
|
|
6933
|
-
return step([
|
|
6934
|
-
n,
|
|
6935
|
-
v
|
|
6936
|
-
]);
|
|
6937
|
-
};
|
|
6938
|
-
}
|
|
6939
|
-
function step(op) {
|
|
6940
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
6941
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
6942
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
6943
|
-
if (y = 0, t) op = [
|
|
6944
|
-
op[0] & 2,
|
|
6945
|
-
t.value
|
|
6946
|
-
];
|
|
6947
|
-
switch(op[0]){
|
|
6948
|
-
case 0:
|
|
6949
|
-
case 1:
|
|
6950
|
-
t = op;
|
|
6951
|
-
break;
|
|
6952
|
-
case 4:
|
|
6953
|
-
_.label++;
|
|
6954
|
-
return {
|
|
6955
|
-
value: op[1],
|
|
6956
|
-
done: false
|
|
6957
|
-
};
|
|
6958
|
-
case 5:
|
|
6959
|
-
_.label++;
|
|
6960
|
-
y = op[1];
|
|
6961
|
-
op = [
|
|
6962
|
-
0
|
|
6963
|
-
];
|
|
6964
|
-
continue;
|
|
6965
|
-
case 7:
|
|
6966
|
-
op = _.ops.pop();
|
|
6967
|
-
_.trys.pop();
|
|
6968
|
-
continue;
|
|
6969
|
-
default:
|
|
6970
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
6971
|
-
_ = 0;
|
|
6972
|
-
continue;
|
|
6973
|
-
}
|
|
6974
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
6975
|
-
_.label = op[1];
|
|
6976
|
-
break;
|
|
6977
|
-
}
|
|
6978
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
6979
|
-
_.label = t[1];
|
|
6980
|
-
t = op;
|
|
6981
|
-
break;
|
|
6982
|
-
}
|
|
6983
|
-
if (t && _.label < t[2]) {
|
|
6984
|
-
_.label = t[2];
|
|
6985
|
-
_.ops.push(op);
|
|
6986
|
-
break;
|
|
6987
|
-
}
|
|
6988
|
-
if (t[2]) _.ops.pop();
|
|
6989
|
-
_.trys.pop();
|
|
6990
|
-
continue;
|
|
6991
|
-
}
|
|
6992
|
-
op = body.call(thisArg, _);
|
|
6993
|
-
} catch (e) {
|
|
6994
|
-
op = [
|
|
6995
|
-
6,
|
|
6996
|
-
e
|
|
6997
|
-
];
|
|
6998
|
-
y = 0;
|
|
6999
|
-
} finally{
|
|
7000
|
-
f = t = 0;
|
|
7001
|
-
}
|
|
7002
|
-
if (op[0] & 5) throw op[1];
|
|
7003
|
-
return {
|
|
7004
|
-
value: op[0] ? op[1] : void 0,
|
|
7005
|
-
done: true
|
|
7006
|
-
};
|
|
7007
|
-
}
|
|
7008
|
-
}
|
|
7009
|
-
/**
|
|
7010
|
-
* @class Ptz
|
|
7011
|
-
* @classdesc 云台控制
|
|
7012
|
-
*
|
|
7013
|
-
* @example
|
|
7014
|
-
* // 初始化云台控制
|
|
7015
|
-
* // 显示云台控制
|
|
7016
|
-
* ptz.show()
|
|
7017
|
-
* // 隐藏云台控制
|
|
7018
|
-
* ptz.hide()
|
|
7019
|
-
*/ var Ptz = /*#__PURE__*/ function(BasePtz) {
|
|
7020
|
-
_inherits(Ptz, BasePtz);
|
|
7021
|
-
function Ptz(container, options) {
|
|
7022
|
-
if (options === void 0) options = {};
|
|
7023
|
-
var _this;
|
|
7024
|
-
_this = BasePtz.call(this, container, options) || this, _this._isMobile = utilsTools.isMobile(), _this._isRotate = false, _this._clearTimer = null;
|
|
7025
|
-
_this._$wrapper = document.createElement('div');
|
|
7026
|
-
_this._$wrapper.className = PTZ_PREFIX + '-container-wrap';
|
|
7027
|
-
_this._$directionCircleContainer = document.createElement('div');
|
|
7028
|
-
_this._$directionCircleContainer.classList.add(PTZ_PREFIX + '-container');
|
|
7029
|
-
_this._$directionCircleContainer.innerHTML = '\n <div class="' + PTZ_PREFIX + "-main " + PTZ_DIRECTION_PREFIX + '-center"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-top" data-direction="0"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-top-left" data-direction="4"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-left" data-direction="2"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-left-bottom" data-direction="5"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-bottom" data-direction="1"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-bottom-right" data-direction="7"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-right" data-direction="3"></div>\n <div class="' + PTZ_PREFIX + "-icon " + PTZ_DIRECTION_PREFIX + '-right-top" data-direction="6"></div>\n ';
|
|
7030
|
-
_this._$wrapper.appendChild(_this._$directionCircleContainer);
|
|
7031
|
-
_this._$speedContainer = document.createElement('div');
|
|
7032
|
-
_this._$speedContainer.classList.add(PTZ_PREFIX + '-speed-container');
|
|
7033
|
-
_this._$speedContainer.innerHTML = '\n <div class="' + PTZ_PREFIX + '-speed-progress" title="' + _this.locale['PTZ_SPEED'] + '">\n <div class="' + PTZ_PREFIX + '-speed-progress-line">\n <div class="' + PTZ_PREFIX + "-speed-progress-line-dot " + (_this.speed === 1 ? PTZ_SPEED_ACTIVE_PREFIX : '') + '" data-id="slow" data-index="1" data-value="1"></div>\n <div class="' + PTZ_PREFIX + "-speed-progress-line-dot " + (_this.speed === 3 ? PTZ_SPEED_ACTIVE_PREFIX : '') + '" data-id="mid" data-index="2" data-value="3"></div>\n <div class="' + PTZ_PREFIX + "-speed-progress-line-dot " + (_this.speed === 7 ? PTZ_SPEED_ACTIVE_PREFIX : '') + '" data-id="fast" data-index="3" data-value="7"></div>\n </div>\n <div class="' + PTZ_PREFIX + '-speed-progress-points">\n <div class="' + PTZ_PREFIX + '-speed-progress-points-slow">\n ' + _this.locale['PTZ_SLOW'] + '\n </div>\n <div class="' + PTZ_PREFIX + '-speed-progress-points-mid">\n ' + _this.locale['PTZ_MID'] + '\n </div>\n <div class="' + PTZ_PREFIX + '-speed-progress-points-fast">\n ' + _this.locale['PTZ_FAST'] + "\n </div>\n </div>\n </div>\n ";
|
|
7034
|
-
_this._$wrapper.appendChild(_this._$speedContainer);
|
|
7035
|
-
_this._$btnContainer = document.createElement('div');
|
|
7036
|
-
_this._$btnContainer.classList.add(PTZ_PREFIX + '-btn-container');
|
|
7037
|
-
_this._$btnContainer.innerHTML = '\n <div class="' + PTZ_PREFIX + '-btn-zoom" title="' + _this.locale['DEVICE_ZOOM'] + '" style="user-select: none;">\n <div class="' + PTZ_PREFIX + '-btn-zoom-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M563.2 198.4c179.2 0 326.4 147.2 326.4 326.4s-147.2 326.4-326.4 326.4S230.4 704 230.4 524.8s147.2-326.4 332.8-326.4z m0 64c-147.2 0-262.4 115.2-262.4 262.4s115.2 262.4 262.4 262.4 262.4-115.2 262.4-262.4S704 262.4 563.2 262.4z" fill="#ffffff"></path>\n <path d="M691.2 556.8H428.8c-19.2 0-32-12.8-32-32s12.8-32 32-32h262.4c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#ffffff">\n </path>\n <path d="M556.8 691.2c-19.2 0-32-12.8-32-32V396.8c0-19.2 12.8-32 32-32s32 12.8 32 32v262.4c0 19.2-12.8 32-32 32z" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="' + PTZ_PREFIX + '-btn-zoom-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M569.6 838.4c-172.8 0-307.2-140.8-307.2-307.2s140.8-307.2 307.2-307.2 307.2 140.8 307.2 307.2-140.8 307.2-307.2 307.2z m0-64c134.4 0 249.6-108.8 249.6-249.6S704 281.6 569.6 281.6 320 396.8 320 531.2s108.8 243.2 249.6 243.2z" fill="#ffffff"></path>\n <path d="M691.2 563.2H448c-19.2 0-32-12.8-32-32s12.8-38.4 32-38.4h249.6c19.2 0 32 12.8 32 32s-19.2 38.4-38.4 38.4z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n <div class="' + PTZ_PREFIX + '-btn-focal" title="' + _this.locale['DEVICE_FOCUS'] + '" style="user-select: none;">\n <div class="' + PTZ_PREFIX + '-btn-focal-add" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M646.4 825.6H320c-44.8 0-83.2-38.4-83.2-83.2V409.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6zM320 390.4c-12.8 0-19.2 6.4-19.2 19.2v326.4c0 12.8 6.4 19.2 19.2 19.2h326.4c12.8 0 19.2-6.4 19.2-19.2V409.6c0-12.8-6.4-19.2-19.2-19.2H320z" fill="#ffffff"></path>\n <path d="M396.8 358.4V281.6c0-25.6 25.6-51.2 51.2-51.2h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H704l-6.4-268.8" fill="#ffffff"></path>\n </svg>\n </div>\n <div class="' + PTZ_PREFIX + '-btn-focal-sub" style="user-select: none;">\n <svg viewBox="0 0 1088 1024" version="1.1" width="20" height="20">\n <path d="M320 358.4h326.4c25.6 0 51.2 25.6 51.2 51.2v326.4c0 25.6-25.6 51.2-51.2 51.2H320c-25.6 0-51.2-25.6-51.2-51.2V409.6c0-25.6 25.6-51.2 51.2-51.2z" fill="#ffffff"></path>\n <path d="M774.4 697.6H704c-19.2 0-32-12.8-32-32s12.8-32 32-32h70.4c12.8 0 19.2-6.4 19.2-19.2V281.6c0-12.8-6.4-19.2-19.2-19.2H448c-12.8 0-19.2 6.4-19.2 19.2v70.4c0 19.2-12.8 32-32 32s-32-12.8-32-25.6V281.6c0-44.8 38.4-83.2 83.2-83.2h326.4c44.8 0 83.2 38.4 83.2 83.2v326.4c0 51.2-38.4 89.6-83.2 89.6z" fill="#ffffff"></path>\n </svg>\n </div>\n </div>\n ';
|
|
7038
|
-
_this._$wrapper.appendChild(_this._$btnContainer);
|
|
7039
|
-
container.appendChild(_this._$wrapper);
|
|
7040
|
-
// 云台控制事件绑定
|
|
7041
|
-
// 云台控制
|
|
7042
|
-
_this._$directionCircleContainer.onmousedown = function(e) {
|
|
7043
|
-
e.preventDefault();
|
|
7044
|
-
e.stopPropagation();
|
|
7045
|
-
_this._handlePtzTouch(e, 'start');
|
|
7046
|
-
};
|
|
7047
|
-
_this._$directionCircleContainer.onmouseup = function(e) {
|
|
7048
|
-
e.preventDefault();
|
|
7049
|
-
e.stopPropagation();
|
|
7050
|
-
_this._handlePtzTouch(e, 'stop');
|
|
7051
|
-
};
|
|
7052
|
-
_this._$directionCircleContainer.ontouchstart = function(e) {
|
|
7053
|
-
e.preventDefault();
|
|
7054
|
-
e.stopPropagation();
|
|
7055
|
-
_this._handlePtzTouch(e, 'start');
|
|
7056
|
-
};
|
|
7057
|
-
_this._$directionCircleContainer.ontouchend = function(e) {
|
|
7058
|
-
e.preventDefault();
|
|
7059
|
-
e.stopPropagation();
|
|
7060
|
-
_this._handlePtzTouch(e, 'stop');
|
|
7061
|
-
};
|
|
7062
|
-
_this._onSwitchSpeed = function(e) {
|
|
7063
|
-
var list = Array.from(_this._$speedContainer.querySelectorAll("." + PTZ_PREFIX + "-speed-progress-line-dot"));
|
|
7064
|
-
if (list.includes(e.target) && !e.target.classList.contains(PTZ_SPEED_ACTIVE_PREFIX)) {
|
|
7065
|
-
list.forEach(function(item) {
|
|
7066
|
-
if (item === e.target) {
|
|
7067
|
-
item.classList.add(PTZ_SPEED_ACTIVE_PREFIX);
|
|
7068
|
-
} else {
|
|
7069
|
-
item.classList.remove(PTZ_SPEED_ACTIVE_PREFIX);
|
|
7070
|
-
}
|
|
7071
|
-
});
|
|
7072
|
-
var value = e.target.getAttribute('data-value');
|
|
7073
|
-
var index = e.target.getAttribute('data-index');
|
|
7074
|
-
_this.speed = +value;
|
|
7075
|
-
_this.options.onSpeedChange == null ? void 0 : _this.options.onSpeedChange.call(_this.options, +index);
|
|
7076
|
-
}
|
|
7077
|
-
};
|
|
7078
|
-
// mouse 事件绑定
|
|
7079
|
-
// 云台速度变化事件绑定
|
|
7080
|
-
_this._$speedContainer.onmouseup = _this._onSwitchSpeed;
|
|
7081
|
-
if (_this._isMobile) {
|
|
7082
|
-
_this._$speedContainer.ontouchend = _this._onSwitchSpeed;
|
|
7083
|
-
}
|
|
7084
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add")) {
|
|
7085
|
-
// 物理缩放、变焦按钮事件监听
|
|
7086
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").onmousedown = function(e) {
|
|
7087
|
-
e.preventDefault();
|
|
7088
|
-
e.stopPropagation();
|
|
7089
|
-
_this._handleBtnTouch('zoom', 'add', 'start');
|
|
7090
|
-
};
|
|
7091
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").onmouseup = function(e) {
|
|
7092
|
-
e.preventDefault();
|
|
7093
|
-
e.stopPropagation();
|
|
7094
|
-
_this._handleBtnTouch('zoom', 'add', 'stop');
|
|
7095
|
-
};
|
|
7096
|
-
}
|
|
7097
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub")) {
|
|
7098
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").onmousedown = function(e) {
|
|
7099
|
-
e.preventDefault();
|
|
7100
|
-
e.stopPropagation();
|
|
7101
|
-
_this._handleBtnTouch('zoom', 'sub', 'start');
|
|
7102
|
-
};
|
|
7103
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").onmouseup = function(e) {
|
|
7104
|
-
e.preventDefault();
|
|
7105
|
-
e.stopPropagation();
|
|
7106
|
-
_this._handleBtnTouch('zoom', 'sub', 'stop');
|
|
7107
|
-
};
|
|
7108
|
-
}
|
|
7109
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add")) {
|
|
7110
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").onmousedown = function(e) {
|
|
7111
|
-
e.preventDefault();
|
|
7112
|
-
e.stopPropagation();
|
|
7113
|
-
_this._handleBtnTouch('focal', 'add', 'start');
|
|
7114
|
-
};
|
|
7115
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").onmouseup = function(e) {
|
|
7116
|
-
e.preventDefault();
|
|
7117
|
-
e.stopPropagation();
|
|
7118
|
-
_this._handleBtnTouch('focal', 'add', 'stop');
|
|
7119
|
-
};
|
|
7120
|
-
}
|
|
7121
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub")) {
|
|
7122
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").onmousedown = function(e) {
|
|
7123
|
-
e.preventDefault();
|
|
7124
|
-
e.stopPropagation();
|
|
7125
|
-
_this._handleBtnTouch('focal', 'sub', 'start');
|
|
7126
|
-
};
|
|
7127
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").onmouseup = function(e) {
|
|
7128
|
-
e.preventDefault();
|
|
7129
|
-
e.stopPropagation();
|
|
7130
|
-
_this._handleBtnTouch('focal', 'sub', 'stop');
|
|
7131
|
-
};
|
|
7132
|
-
}
|
|
7133
|
-
// mobile touch 事件监听
|
|
7134
|
-
if (_this._isMobile) {
|
|
7135
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add")) {
|
|
7136
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").ontouchstart = function(e) {
|
|
7137
|
-
e.preventDefault();
|
|
7138
|
-
e.stopPropagation();
|
|
7139
|
-
_this._handleBtnTouch('zoom', 'add', 'start');
|
|
7140
|
-
};
|
|
7141
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-add").ontouchend = function(e) {
|
|
7142
|
-
e.preventDefault();
|
|
7143
|
-
e.stopPropagation();
|
|
7144
|
-
_this._handleBtnTouch('zoom', 'add', 'stop');
|
|
7145
|
-
};
|
|
7146
|
-
}
|
|
7147
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub")) {
|
|
7148
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").ontouchstart = function(e) {
|
|
7149
|
-
e.preventDefault();
|
|
7150
|
-
e.stopPropagation();
|
|
7151
|
-
_this._handleBtnTouch('zoom', 'sub', 'start');
|
|
7152
|
-
};
|
|
7153
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-zoom-sub").ontouchend = function(e) {
|
|
7154
|
-
e.preventDefault();
|
|
7155
|
-
e.stopPropagation();
|
|
7156
|
-
_this._handleBtnTouch('zoom', 'sub', 'stop');
|
|
7157
|
-
};
|
|
7158
|
-
}
|
|
7159
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add")) {
|
|
7160
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").ontouchstart = function(e) {
|
|
7161
|
-
e.preventDefault();
|
|
7162
|
-
e.stopPropagation();
|
|
7163
|
-
_this._handleBtnTouch('focal', 'add', 'start');
|
|
7164
|
-
};
|
|
7165
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-add").ontouchend = function(e) {
|
|
7166
|
-
e.preventDefault();
|
|
7167
|
-
e.stopPropagation();
|
|
7168
|
-
_this._handleBtnTouch('focal', 'add', 'stop');
|
|
7169
|
-
};
|
|
7170
|
-
}
|
|
7171
|
-
if (_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub")) {
|
|
7172
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").ontouchstart = function(e) {
|
|
7173
|
-
e.preventDefault();
|
|
7174
|
-
e.stopPropagation();
|
|
7175
|
-
_this._handleBtnTouch('focal', 'sub', 'start');
|
|
7176
|
-
};
|
|
7177
|
-
_this._$btnContainer.querySelector("." + PTZ_PREFIX + "-btn-focal-sub").ontouchend = function(e) {
|
|
7178
|
-
e.preventDefault();
|
|
7179
|
-
e.stopPropagation();
|
|
7180
|
-
_this._handleBtnTouch('focal', 'sub', 'stop');
|
|
7181
|
-
};
|
|
7182
|
-
}
|
|
7183
|
-
}
|
|
7184
|
-
return _this;
|
|
7185
|
-
}
|
|
7186
|
-
var _proto = Ptz.prototype;
|
|
7187
|
-
_proto.destroy = function destroy() {
|
|
7188
|
-
if (this._clearTimer) {
|
|
7189
|
-
clearTimeout(this._clearTimer);
|
|
7190
|
-
this._clearTimer = null;
|
|
7191
|
-
}
|
|
7192
|
-
if (this._$directionCircleContainer) {
|
|
7193
|
-
this._$directionCircleContainer.remove();
|
|
7194
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7195
|
-
this._$directionCircleContainer = null;
|
|
7196
|
-
}
|
|
7197
|
-
if (this._$speedContainer) {
|
|
7198
|
-
this._onSwitchSpeed = null;
|
|
7199
|
-
this._$speedContainer.remove();
|
|
7200
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7201
|
-
this._$speedContainer = null;
|
|
7202
|
-
}
|
|
7203
|
-
if (this._$btnContainer) {
|
|
7204
|
-
this._$btnContainer.remove();
|
|
7205
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7206
|
-
this._$btnContainer = null;
|
|
7207
|
-
}
|
|
7208
|
-
if (this._$wrapper) {
|
|
7209
|
-
this._$wrapper.remove();
|
|
7210
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7211
|
-
this._$wrapper = null;
|
|
7212
|
-
}
|
|
7213
|
-
BasePtz.prototype.destroy.call(this);
|
|
7214
|
-
};
|
|
7215
|
-
_proto._handlePtzTouch = function _handlePtzTouch(e, type) {
|
|
7216
|
-
var _this = this;
|
|
7217
|
-
var _this_options_token_deviceToken, _this_options_token, _this_options_env, _this_options_token_deviceToken1, _this_options_token1;
|
|
7218
|
-
if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
|
|
7219
|
-
// 初始化或获取当前PTZ操作队列
|
|
7220
|
-
if (!this._ptzQueue) {
|
|
7221
|
-
this._ptzQueue = Promise.resolve();
|
|
7222
|
-
}
|
|
7223
|
-
var container = this._$directionCircleContainer.getBoundingClientRect();
|
|
7224
|
-
var containerCenterX = container.left + (this._$directionCircleContainer.clientWidth + 2) / 2;
|
|
7225
|
-
var containerCenterY = container.top + (this._$directionCircleContainer.clientHeight + 2) / 2;
|
|
7226
|
-
var eventX = e.x || e.changedTouches[0].clientX;
|
|
7227
|
-
var eventY = e.y || e.changedTouches[0].clientY;
|
|
7228
|
-
var direction = 0;
|
|
7229
|
-
var url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
|
|
7230
|
-
var token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken1 = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken1.video);
|
|
7231
|
-
var backDeg = 0;
|
|
7232
|
-
function getAreaId(x, y) {
|
|
7233
|
-
// 获取当前点击位置相对于圆心的角度
|
|
7234
|
-
var rad = Math.atan2(y, x);
|
|
7235
|
-
if (rad < 0) rad += 2 * Math.PI;
|
|
7236
|
-
var deg = rad * (180 / Math.PI) - 225 - 12.5;
|
|
7237
|
-
if (deg < 0) deg += 360;
|
|
7238
|
-
return Math.floor(deg / 45) + 1;
|
|
7239
|
-
}
|
|
7240
|
-
// 兼容画面旋转90度
|
|
7241
|
-
// const isRotate = false; // /^rotate\(90/.test(document.getElementById(`${this.jSPlugin.id}-wrap`).style.transform);
|
|
7242
|
-
var left = eventX - containerCenterX;
|
|
7243
|
-
var top = eventY - containerCenterY;
|
|
7244
|
-
if (this.isRotate) {
|
|
7245
|
-
switch(getAreaId(left, top)){
|
|
7246
|
-
case 1:
|
|
7247
|
-
direction = 2;
|
|
7248
|
-
backDeg = 90;
|
|
7249
|
-
break;
|
|
7250
|
-
case 2:
|
|
7251
|
-
direction = 4;
|
|
7252
|
-
backDeg = 135;
|
|
7253
|
-
break;
|
|
7254
|
-
case 3:
|
|
7255
|
-
direction = 0;
|
|
7256
|
-
backDeg = 180;
|
|
7257
|
-
break;
|
|
7258
|
-
case 4:
|
|
7259
|
-
direction = 6;
|
|
7260
|
-
backDeg = 225;
|
|
7261
|
-
break;
|
|
7262
|
-
case 5:
|
|
7263
|
-
direction = 3;
|
|
7264
|
-
backDeg = 270;
|
|
7265
|
-
break;
|
|
7266
|
-
case 6:
|
|
7267
|
-
direction = 7;
|
|
7268
|
-
backDeg = 315;
|
|
7269
|
-
break;
|
|
7270
|
-
case 7:
|
|
7271
|
-
direction = 1;
|
|
7272
|
-
backDeg = 0;
|
|
7273
|
-
break;
|
|
7274
|
-
case 8:
|
|
7275
|
-
direction = 5;
|
|
7276
|
-
backDeg = 45;
|
|
7277
|
-
break;
|
|
7278
|
-
}
|
|
7279
|
-
} else {
|
|
7280
|
-
switch(getAreaId(left, top)){
|
|
7281
|
-
case 1:
|
|
7282
|
-
direction = 0;
|
|
7283
|
-
backDeg = 180;
|
|
7284
|
-
break;
|
|
7285
|
-
case 2:
|
|
7286
|
-
direction = 6;
|
|
7287
|
-
backDeg = 225;
|
|
7288
|
-
break;
|
|
7289
|
-
case 3:
|
|
7290
|
-
direction = 3;
|
|
7291
|
-
backDeg = 270;
|
|
7292
|
-
break;
|
|
7293
|
-
case 4:
|
|
7294
|
-
direction = 7;
|
|
7295
|
-
backDeg = 315;
|
|
7296
|
-
break;
|
|
7297
|
-
case 5:
|
|
7298
|
-
direction = 1;
|
|
7299
|
-
backDeg = 0;
|
|
7300
|
-
break;
|
|
7301
|
-
case 6:
|
|
7302
|
-
direction = 5;
|
|
7303
|
-
backDeg = 45;
|
|
7304
|
-
break;
|
|
7305
|
-
case 7:
|
|
7306
|
-
direction = 2;
|
|
7307
|
-
backDeg = 90;
|
|
7308
|
-
break;
|
|
7309
|
-
case 8:
|
|
7310
|
-
direction = 4;
|
|
7311
|
-
backDeg = 135;
|
|
7312
|
-
break;
|
|
7313
|
-
}
|
|
7314
|
-
}
|
|
7315
|
-
if (this._clearTimer) {
|
|
7316
|
-
clearTimeout(this._clearTimer);
|
|
7317
|
-
this._clearTimer = null;
|
|
7318
|
-
}
|
|
7319
|
-
if (type === 'start') {
|
|
7320
|
-
this._$directionCircleContainer.style.cssText = "background-image:linear-gradient(" + backDeg + "deg, #4277FF 0%, rgba(100,143,252,0.00) 30%)";
|
|
7321
|
-
} else {
|
|
7322
|
-
this._$directionCircleContainer.style.cssText = '';
|
|
7323
|
-
}
|
|
7324
|
-
if (type === 'stop') {
|
|
7325
|
-
var _this_options_env1;
|
|
7326
|
-
url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
|
|
7327
|
-
}
|
|
7328
|
-
var operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
|
|
7329
|
-
areaId: getAreaId(left, top),
|
|
7330
|
-
direction: direction,
|
|
7331
|
-
backDeg: backDeg,
|
|
7332
|
-
isRotate: this.isRotate,
|
|
7333
|
-
speed: this.speed,
|
|
7334
|
-
type: type
|
|
7335
|
-
});
|
|
7336
|
-
var data = new FormData();
|
|
7337
|
-
data.append('deviceSerial', this.options.deviceSerial + '');
|
|
7338
|
-
data.append('channelNo', this.options.channelNo + '');
|
|
7339
|
-
data.append('speed', this.speed + '');
|
|
7340
|
-
data.append('direction', direction + '');
|
|
7341
|
-
data.append('accessToken', token);
|
|
7342
|
-
// 将操作加入队列
|
|
7343
|
-
this._ptzQueue = this._ptzQueue.then(function() {
|
|
7344
|
-
return _async_to_generator(function() {
|
|
7345
|
-
var _this;
|
|
7346
|
-
return _ts_generator(this, function(_state) {
|
|
7347
|
-
switch(_state.label){
|
|
7348
|
-
case 0:
|
|
7349
|
-
_this = this;
|
|
7350
|
-
return [
|
|
7351
|
-
4,
|
|
7352
|
-
fetch(url, {
|
|
7353
|
-
method: 'POST',
|
|
7354
|
-
body: data
|
|
7355
|
-
}).then(function(response) {
|
|
7356
|
-
return _async_to_generator(function() {
|
|
7357
|
-
return _ts_generator(this, function(_state) {
|
|
7358
|
-
switch(_state.label){
|
|
7359
|
-
case 0:
|
|
7360
|
-
return [
|
|
7361
|
-
4,
|
|
7362
|
-
response.json()
|
|
7363
|
-
];
|
|
7364
|
-
case 1:
|
|
7365
|
-
return [
|
|
7366
|
-
2,
|
|
7367
|
-
_state.sent()
|
|
7368
|
-
];
|
|
7369
|
-
}
|
|
7370
|
-
});
|
|
7371
|
-
})();
|
|
7372
|
-
}).then(function(rt) {
|
|
7373
|
-
var _rt_result;
|
|
7374
|
-
operationResultCb == null ? void 0 : operationResultCb(rt);
|
|
7375
|
-
var code = rt.code || (rt == null ? void 0 : (_rt_result = rt.result) == null ? void 0 : _rt_result.code);
|
|
7376
|
-
if ([
|
|
7377
|
-
60000,
|
|
7378
|
-
60001,
|
|
7379
|
-
60002,
|
|
7380
|
-
60003,
|
|
7381
|
-
60004,
|
|
7382
|
-
60005,
|
|
7383
|
-
60006,
|
|
7384
|
-
10002
|
|
7385
|
-
].includes(+code)) {
|
|
7386
|
-
_this._$directionCircleContainer.style.cssText = "background-image:linear-gradient(" + backDeg + "deg, #f45656 0%, rgba(100,143,252,0.00) 30%)";
|
|
7387
|
-
}
|
|
7388
|
-
return rt;
|
|
7389
|
-
}).catch(function(err) {
|
|
7390
|
-
}).finally(function() {
|
|
7391
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7392
|
-
operationResultCb = null;
|
|
7393
|
-
if (type === 'stop') {
|
|
7394
|
-
_this._clearTimer = setTimeout(function() {
|
|
7395
|
-
_this._$directionCircleContainer.style.cssText = '';
|
|
7396
|
-
}, 1000);
|
|
7397
|
-
}
|
|
7398
|
-
})
|
|
7399
|
-
];
|
|
7400
|
-
case 1:
|
|
7401
|
-
// prettier-ignore
|
|
7402
|
-
return [
|
|
7403
|
-
2,
|
|
7404
|
-
_state.sent()
|
|
7405
|
-
];
|
|
7406
|
-
}
|
|
7407
|
-
});
|
|
7408
|
-
}).call(_this);
|
|
7409
|
-
});
|
|
7410
|
-
if (type === 'stop') {
|
|
7411
|
-
this._ptzQueue = this._ptzQueue.finally(function() {});
|
|
7412
|
-
}
|
|
7413
|
-
// this.jSPlugin?.eventEmitter?.emit(EVENTS.ptzDirection, {
|
|
7414
|
-
// areaId: getAreaId(left, top),
|
|
7415
|
-
// direction,
|
|
7416
|
-
// backDeg,
|
|
7417
|
-
// isRotate,
|
|
7418
|
-
// ptzSpeed: this.jSPlugin.ptzSpeed,
|
|
7419
|
-
// type,
|
|
7420
|
-
// });
|
|
7421
|
-
};
|
|
7422
|
-
_proto._handleBtnTouch = function _handleBtnTouch(btn, option, type) {
|
|
7423
|
-
var _this = this;
|
|
7424
|
-
var _this_options_token, _this_options_env, _this_options_token_deviceToken, _this_options_token1;
|
|
7425
|
-
if (!(this.options.accessToken || ((_this_options_token = this.options.token) == null ? void 0 : _this_options_token.deviceToken.video))) throw new Error('Ptz accessToken or token.deviceToken.video is required');
|
|
7426
|
-
// 使用Promise来跟踪当前操作状态
|
|
7427
|
-
if (!this._ptzOperation) {
|
|
7428
|
-
this._ptzOperation = Promise.resolve();
|
|
7429
|
-
}
|
|
7430
|
-
var direction = 8;
|
|
7431
|
-
if (btn === 'zoom') {
|
|
7432
|
-
direction = option === 'add' ? 8 : 9;
|
|
7433
|
-
} else {
|
|
7434
|
-
direction = option === 'add' ? 10 : 11;
|
|
7435
|
-
}
|
|
7436
|
-
var url = ((_this_options_env = this.options.env) == null ? void 0 : _this_options_env.domain) + '/api/lapp/device/ptz/start';
|
|
7437
|
-
var token = this.options.accessToken || ((_this_options_token1 = this.options.token) == null ? void 0 : (_this_options_token_deviceToken = _this_options_token1.deviceToken) == null ? void 0 : _this_options_token_deviceToken.video);
|
|
7438
|
-
if (type === 'stop') {
|
|
7439
|
-
var _this_options_env1;
|
|
7440
|
-
url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
|
|
7441
|
-
}
|
|
7442
|
-
var operationResultCb = this.options.onDirection == null ? void 0 : this.options.onDirection.call(this.options, {
|
|
7443
|
-
btn: btn,
|
|
7444
|
-
option: option,
|
|
7445
|
-
type: type
|
|
7446
|
-
});
|
|
7447
|
-
var data = new FormData();
|
|
7448
|
-
data.append('deviceSerial', this.options.deviceSerial + '');
|
|
7449
|
-
data.append('channelNo', this.options.channelNo + '');
|
|
7450
|
-
data.append('speed', this.speed + '');
|
|
7451
|
-
data.append('direction', direction + '');
|
|
7452
|
-
data.append('accessToken', token);
|
|
7453
|
-
// 将当前操作加入Promise链
|
|
7454
|
-
this._ptzOperation = this._ptzOperation.then(function() {
|
|
7455
|
-
return _async_to_generator(function() {
|
|
7456
|
-
return _ts_generator(this, function(_state) {
|
|
7457
|
-
switch(_state.label){
|
|
7458
|
-
case 0:
|
|
7459
|
-
return [
|
|
7460
|
-
4,
|
|
7461
|
-
fetch(url, {
|
|
7462
|
-
method: 'POST',
|
|
7463
|
-
body: data
|
|
7464
|
-
}).then(function(response) {
|
|
7465
|
-
return _async_to_generator(function() {
|
|
7466
|
-
return _ts_generator(this, function(_state) {
|
|
7467
|
-
switch(_state.label){
|
|
7468
|
-
case 0:
|
|
7469
|
-
return [
|
|
7470
|
-
4,
|
|
7471
|
-
response.json()
|
|
7472
|
-
];
|
|
7473
|
-
case 1:
|
|
7474
|
-
return [
|
|
7475
|
-
2,
|
|
7476
|
-
_state.sent()
|
|
7477
|
-
];
|
|
7478
|
-
}
|
|
7479
|
-
});
|
|
7480
|
-
})();
|
|
7481
|
-
}).then(function(rt) {
|
|
7482
|
-
operationResultCb == null ? void 0 : operationResultCb(rt);
|
|
7483
|
-
return rt;
|
|
7484
|
-
}).catch(function(err) {
|
|
7485
|
-
}).finally(function() {
|
|
7486
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7487
|
-
operationResultCb = null;
|
|
7488
|
-
})
|
|
7489
|
-
];
|
|
7490
|
-
case 1:
|
|
7491
|
-
// prettier-ignore
|
|
7492
|
-
return [
|
|
7493
|
-
2,
|
|
7494
|
-
_state.sent()
|
|
7495
|
-
];
|
|
7496
|
-
}
|
|
7497
|
-
});
|
|
7498
|
-
})();
|
|
7499
|
-
});
|
|
7500
|
-
// 如果是stop操作,添加一个清理操作
|
|
7501
|
-
if (type === 'stop') {
|
|
7502
|
-
this._ptzOperation = this._ptzOperation.finally(function() {
|
|
7503
|
-
_this._ptzOperation = null; // 重置操作链
|
|
7504
|
-
});
|
|
7505
|
-
}
|
|
7506
|
-
};
|
|
7507
|
-
_create_class(Ptz, [
|
|
7508
|
-
{
|
|
7509
|
-
key: "isRotate",
|
|
7510
|
-
get: function get() {
|
|
7511
|
-
return this._isRotate;
|
|
7512
|
-
},
|
|
7513
|
-
set: /**
|
|
7514
|
-
* 是否旋转了
|
|
7515
|
-
*/ function set(isRotate) {
|
|
7516
|
-
this._isRotate = isRotate;
|
|
7517
|
-
}
|
|
7518
|
-
}
|
|
7519
|
-
]);
|
|
7520
|
-
return Ptz;
|
|
7521
|
-
}(BasePtz);
|
|
7522
|
-
|
|
7523
|
-
dist.BasePtz = BasePtz;
|
|
7524
|
-
dist.MobilePtz = MobilePtz;
|
|
7525
|
-
dist.Ptz = Ptz;
|
|
7526
|
-
return dist;
|
|
7527
|
-
}
|
|
7528
|
-
|
|
7529
|
-
var distExports = requireDist();
|
|
7530
|
-
|
|
7531
5854
|
function _defineProperties$4(target, props) {
|
|
7532
5855
|
for(var i = 0; i < props.length; i++){
|
|
7533
5856
|
var descriptor = props[i];
|
|
@@ -7625,7 +5948,7 @@ function _set_prototype_of$e(o, p) {
|
|
|
7625
5948
|
this.$turntable.classList.add("" + PREFIX_CLASS + "-ptz-turntable");
|
|
7626
5949
|
this.$panel.appendChild(this.$turntable);
|
|
7627
5950
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7628
|
-
this._ptzControl = new
|
|
5951
|
+
this._ptzControl = new controlPtz.Ptz(this.$turntable, _extends$d({}, this._options, {
|
|
7629
5952
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7630
5953
|
onDirection: this._onDirection.bind(this)
|
|
7631
5954
|
}));
|
|
@@ -7634,7 +5957,7 @@ function _set_prototype_of$e(o, p) {
|
|
|
7634
5957
|
};
|
|
7635
5958
|
_proto.renderMobileExtend = function renderMobileExtend($container) {
|
|
7636
5959
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7637
|
-
if (!this._ptzControl1) this._ptzControl1 = new
|
|
5960
|
+
if (!this._ptzControl1) this._ptzControl1 = new controlPtz.MobilePtz($container, _extends$d({}, this._options, {
|
|
7638
5961
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7639
5962
|
onDirection: this._onDirection.bind(this)
|
|
7640
5963
|
}));
|
|
@@ -8338,17 +6661,17 @@ function _ts_generator$3(thisArg, body) {
|
|
|
8338
6661
|
classNameSuffix: 'broadcast'
|
|
8339
6662
|
})) || this;
|
|
8340
6663
|
_this._options = options;
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
_this.
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
_this.$container.style.removeProperty(
|
|
6664
|
+
_this._render();
|
|
6665
|
+
_this.on(EVENTS.broadcastChange, function(active) {
|
|
6666
|
+
if (_this.active !== active) {
|
|
6667
|
+
_this.active = active;
|
|
6668
|
+
_this._render();
|
|
6669
|
+
}
|
|
6670
|
+
});
|
|
6671
|
+
if (options.sdkType === 'base') {
|
|
6672
|
+
_this.$container.style.removeProperty('display');
|
|
8350
6673
|
} else {
|
|
8351
|
-
_this.$container.style.display =
|
|
6674
|
+
_this.$container.style.display = 'none';
|
|
8352
6675
|
}
|
|
8353
6676
|
return _this;
|
|
8354
6677
|
}
|
|
@@ -8368,16 +6691,16 @@ function _ts_generator$3(thisArg, body) {
|
|
|
8368
6691
|
}
|
|
8369
6692
|
};
|
|
8370
6693
|
/**
|
|
8371
|
-
|
|
8372
|
-
|
|
6694
|
+
* 销毁语音广播控件
|
|
6695
|
+
*/ _proto.destroy = function destroy() {
|
|
8373
6696
|
if (this.active) {
|
|
8374
6697
|
this.reset();
|
|
8375
6698
|
}
|
|
8376
6699
|
Control.prototype.destroy.call(this);
|
|
8377
6700
|
};
|
|
8378
6701
|
/**
|
|
8379
|
-
|
|
8380
|
-
|
|
6702
|
+
* 点击 Control 会触发
|
|
6703
|
+
*/ _proto._onControlClick = function _onControlClick(e) {
|
|
8381
6704
|
var _this = this, _superprop_get__onControlClick = function() {
|
|
8382
6705
|
return Control.prototype._onControlClick;
|
|
8383
6706
|
};
|
|
@@ -8568,17 +6891,17 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8568
6891
|
classNameSuffix: 'aichat'
|
|
8569
6892
|
})) || this;
|
|
8570
6893
|
_this._options = options;
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
_this.
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
_this.$container.style.removeProperty(
|
|
6894
|
+
_this._render();
|
|
6895
|
+
_this.on(EVENTS.aichatChange, function(active) {
|
|
6896
|
+
if (_this.active !== active) {
|
|
6897
|
+
_this.active = active;
|
|
6898
|
+
_this._render();
|
|
6899
|
+
}
|
|
6900
|
+
});
|
|
6901
|
+
if (options.urlInfo.searchParams.busType !== '7' && options.urlInfo.recType === 'cloud' && options.sdkType === 'base') {
|
|
6902
|
+
_this.$container.style.removeProperty('display');
|
|
8580
6903
|
} else {
|
|
8581
|
-
_this.$container.style.display =
|
|
6904
|
+
_this.$container.style.display = 'none';
|
|
8582
6905
|
}
|
|
8583
6906
|
return _this;
|
|
8584
6907
|
}
|
|
@@ -8598,16 +6921,16 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8598
6921
|
}
|
|
8599
6922
|
};
|
|
8600
6923
|
/**
|
|
8601
|
-
|
|
8602
|
-
|
|
6924
|
+
* 销毁AI对话框控件
|
|
6925
|
+
*/ _proto.destroy = function destroy() {
|
|
8603
6926
|
if (this.active) {
|
|
8604
6927
|
this.reset();
|
|
8605
6928
|
}
|
|
8606
6929
|
Control.prototype.destroy.call(this);
|
|
8607
6930
|
};
|
|
8608
6931
|
/**
|
|
8609
|
-
|
|
8610
|
-
|
|
6932
|
+
* 点击 Control 会触发
|
|
6933
|
+
*/ _proto._onControlClick = function _onControlClick(e) {
|
|
8611
6934
|
var _this = this, _superprop_get__onControlClick = function() {
|
|
8612
6935
|
return Control.prototype._onControlClick;
|
|
8613
6936
|
};
|
|
@@ -9272,7 +7595,7 @@ function _set_prototype_of$6(o, p) {
|
|
|
9272
7595
|
classNameSuffix: 'date'
|
|
9273
7596
|
})) || this;
|
|
9274
7597
|
_this.options = options;
|
|
9275
|
-
_this._value =
|
|
7598
|
+
_this._value = utilsTools.DateTime.format(((_this_options_props = _this.options.props) == null ? void 0 : (_this_options_props_urlInfo = _this_options_props.urlInfo) == null ? void 0 : (_this_options_props_urlInfo_searchParams = _this_options_props_urlInfo.searchParams) == null ? void 0 : _this_options_props_urlInfo_searchParams.begin) || new Date(), 'YYYY-MM-DD');
|
|
9276
7599
|
_this._render();
|
|
9277
7600
|
// 日期上的点
|
|
9278
7601
|
_this.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
@@ -9285,7 +7608,7 @@ function _set_prototype_of$6(o, p) {
|
|
|
9285
7608
|
_proto._render = function _render() {
|
|
9286
7609
|
var _this = this;
|
|
9287
7610
|
var _this_options_props;
|
|
9288
|
-
var isMobile1 =
|
|
7611
|
+
var isMobile1 = utilsTools.isMobile();
|
|
9289
7612
|
if (isMobile1) {
|
|
9290
7613
|
var _this_locale;
|
|
9291
7614
|
this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS + '-mobile-date-filter" title="' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS + '-mobile-date-filter-value">' + this._getDateStr() + "</span>\n " + IconComponents.filter() + "\n <span>";
|
|
@@ -9307,7 +7630,7 @@ function _set_prototype_of$6(o, p) {
|
|
|
9307
7630
|
],
|
|
9308
7631
|
badges: ((_this_options_props = this.options.props) == null ? void 0 : _this_options_props.recMonth) || [],
|
|
9309
7632
|
language: this.options.language === 'zh' ? 'zh' : 'en',
|
|
9310
|
-
current:
|
|
7633
|
+
current: utilsTools.DateTime.toDate(this._value),
|
|
9311
7634
|
placement: 'tr',
|
|
9312
7635
|
triggerClose: true,
|
|
9313
7636
|
disabledDate: function(date) {
|
|
@@ -9315,8 +7638,8 @@ function _set_prototype_of$6(o, p) {
|
|
|
9315
7638
|
},
|
|
9316
7639
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9317
7640
|
onOk: function(date, _mode) {
|
|
9318
|
-
if (date && _this._value !==
|
|
9319
|
-
_this._value =
|
|
7641
|
+
if (date && _this._value !== utilsTools.DateTime.format(date, 'YYYY-MM-DD') && isMobile1) {
|
|
7642
|
+
_this._value = utilsTools.DateTime.format(date, 'YYYY-MM-DD');
|
|
9320
7643
|
_this.options.onOk == null ? void 0 : _this.options.onOk.call(_this.options, date);
|
|
9321
7644
|
_this.emit(EVENTS.control.dateChange, date);
|
|
9322
7645
|
if (date && _this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
@@ -9325,8 +7648,8 @@ function _set_prototype_of$6(o, p) {
|
|
|
9325
7648
|
}
|
|
9326
7649
|
},
|
|
9327
7650
|
onChange: function(date, mode) {
|
|
9328
|
-
if (date && _this._value !==
|
|
9329
|
-
_this._value =
|
|
7651
|
+
if (date && _this._value !== utilsTools.DateTime.format(date, 'YYYY-MM-DD') && !isMobile1 && mode === 'date') {
|
|
7652
|
+
_this._value = utilsTools.DateTime.format(date, 'YYYY-MM-DD');
|
|
9330
7653
|
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
9331
7654
|
_this.emit(EVENTS.control.dateChange, date);
|
|
9332
7655
|
}
|
|
@@ -9345,8 +7668,8 @@ function _set_prototype_of$6(o, p) {
|
|
|
9345
7668
|
if (change === void 0) change = true;
|
|
9346
7669
|
var _this_datePicker;
|
|
9347
7670
|
(_this_datePicker = this.datePicker) == null ? void 0 : _this_datePicker.setCurrent(date, change);
|
|
9348
|
-
if (date && !change && this._value !==
|
|
9349
|
-
this._value =
|
|
7671
|
+
if (date && !change && this._value !== utilsTools.DateTime.format(date, 'YYYY-MM-DD')) {
|
|
7672
|
+
this._value = utilsTools.DateTime.format(date, 'YYYY-MM-DD');
|
|
9350
7673
|
if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
9351
7674
|
this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = this._getDateStr();
|
|
9352
7675
|
}
|
|
@@ -9479,7 +7802,7 @@ function _set_prototype_of$5(o, p) {
|
|
|
9479
7802
|
}
|
|
9480
7803
|
}
|
|
9481
7804
|
};
|
|
9482
|
-
if (
|
|
7805
|
+
if (utilsTools.isMobile()) {
|
|
9483
7806
|
this.timeLineUtil = new controlTimeLine.MobileTimeLine(this.$container, _timeLineOptions);
|
|
9484
7807
|
} else {
|
|
9485
7808
|
this.timeLineUtil = new controlTimeLine.TimeLine(this.$container, _timeLineOptions);
|
|
@@ -9489,7 +7812,7 @@ function _set_prototype_of$5(o, p) {
|
|
|
9489
7812
|
this.timeLineUtil.update(new Date());
|
|
9490
7813
|
};
|
|
9491
7814
|
_proto.setWidth = function setWidth(width) {
|
|
9492
|
-
if (!
|
|
7815
|
+
if (!utilsTools.isMobile()) this.timeLineUtil.resize(width);
|
|
9493
7816
|
};
|
|
9494
7817
|
_proto._renderAddReduce = function _renderAddReduce() {
|
|
9495
7818
|
var _this = this;
|
|
@@ -9620,7 +7943,7 @@ var Controls = {
|
|
|
9620
7943
|
talk: Talk,
|
|
9621
7944
|
broadcast: Broadcast,
|
|
9622
7945
|
aiChat: AIChat,
|
|
9623
|
-
zoom: Zoom
|
|
7946
|
+
zoom: Zoom,
|
|
9624
7947
|
definition: Definition,
|
|
9625
7948
|
fullscreen: Fullscreen,
|
|
9626
7949
|
globalFullscreen: GlobalFullscreen,
|
|
@@ -10166,12 +8489,12 @@ function _renderControls(theme, $container, btnList, props) {
|
|
|
10166
8489
|
for(var _iterator = _create_for_of_iterator_helper_loose$1(btnList), _step; !(_step = _iterator()).done;){
|
|
10167
8490
|
var item = _step.value;
|
|
10168
8491
|
var _theme_options_mobileExtendOptions, // 在移动端支持扩展和窗口区域渲染
|
|
10169
|
-
_theme_options_mobileExtendOptions_controls, _theme_options_mobileExtendOptions1
|
|
10170
|
-
if (((((_theme_options_mobileExtendOptions = theme.options.mobileExtendOptions) == null ? void 0 : _theme_options_mobileExtendOptions.controls) || []).includes(item.iconId) && item.iconId !== "ptz" || ((_theme_options_mobileExtendOptions1 = theme.options.mobileExtendOptions) == null ? void 0 : (_theme_options_mobileExtendOptions_controls = _theme_options_mobileExtendOptions1.controls) == null ? void 0 : _theme_options_mobileExtendOptions_controls.includes('rec')) && REC_GROUP
|
|
8492
|
+
_theme_options_mobileExtendOptions_controls, _theme_options_mobileExtendOptions1;
|
|
8493
|
+
if (((((_theme_options_mobileExtendOptions = theme.options.mobileExtendOptions) == null ? void 0 : _theme_options_mobileExtendOptions.controls) || []).includes(item.iconId) && item.iconId !== "ptz" || ((_theme_options_mobileExtendOptions1 = theme.options.mobileExtendOptions) == null ? void 0 : (_theme_options_mobileExtendOptions_controls = _theme_options_mobileExtendOptions1.controls) == null ? void 0 : _theme_options_mobileExtendOptions_controls.includes('rec')) && REC_GROUP.includes(item.iconId) // 移动端模式下,不渲染在header 中控件, 需要移动到mobileExtend中
|
|
10171
8494
|
) && Utils.isMobile) {
|
|
10172
8495
|
continue;
|
|
10173
8496
|
}
|
|
10174
|
-
if (REC_GROUP
|
|
8497
|
+
if (REC_GROUP.includes(item.iconId) && theme._header) {
|
|
10175
8498
|
_renderRecType(theme, theme._header.$right, item.iconId, props);
|
|
10176
8499
|
continue;
|
|
10177
8500
|
}
|
|
@@ -10179,7 +8502,7 @@ function _renderControls(theme, $container, btnList, props) {
|
|
|
10179
8502
|
if (theme.options.deviceOptions !== null) {
|
|
10180
8503
|
var _theme_controls;
|
|
10181
8504
|
if (!((_theme_controls = theme.controls) == null ? void 0 : _theme_controls["deviceControl"])) {
|
|
10182
|
-
var
|
|
8505
|
+
var _theme_options;
|
|
10183
8506
|
// eslint-disable-next-line @typescript-eslint/dot-notation, new-cap, @typescript-eslint/no-unsafe-argument
|
|
10184
8507
|
theme.controls["deviceControl"] = new Controls["device"](_extends$1({
|
|
10185
8508
|
rootContainer: theme.$container,
|
|
@@ -10192,7 +8515,7 @@ function _renderControls(theme, $container, btnList, props) {
|
|
|
10192
8515
|
type: theme.options.type,
|
|
10193
8516
|
deviceSerial: theme.urlInfo.deviceSerial,
|
|
10194
8517
|
channelNo: theme.urlInfo.channelNo
|
|
10195
|
-
}, ((
|
|
8518
|
+
}, ((_theme_options = theme.options) == null ? void 0 : _theme_options["deviceOptions"]) || {}, {
|
|
10196
8519
|
props: props
|
|
10197
8520
|
}));
|
|
10198
8521
|
}
|
|
@@ -10202,7 +8525,7 @@ function _renderControls(theme, $container, btnList, props) {
|
|
|
10202
8525
|
// footer
|
|
10203
8526
|
if (Controls[item.iconId]) {
|
|
10204
8527
|
if (theme.options["" + item.iconId + "Options"] !== null) {
|
|
10205
|
-
var
|
|
8528
|
+
var _theme_options1;
|
|
10206
8529
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
10207
8530
|
theme.controls["" + item.iconId + "Control"] = new Controls[item.iconId](_extends$1({
|
|
10208
8531
|
rootContainer: theme.$container,
|
|
@@ -10221,7 +8544,7 @@ function _renderControls(theme, $container, btnList, props) {
|
|
|
10221
8544
|
} : {}, {
|
|
10222
8545
|
PLAY_TYPE: theme.options.type,
|
|
10223
8546
|
sdkType: theme.options.sdkType
|
|
10224
|
-
}, ((
|
|
8547
|
+
}, ((_theme_options1 = theme.options) == null ? void 0 : _theme_options1["" + item.iconId + "Options"]) || {}, {
|
|
10225
8548
|
props: props
|
|
10226
8549
|
}));
|
|
10227
8550
|
}
|
|
@@ -10374,8 +8697,7 @@ function _renderTheme(theme, data) {
|
|
|
10374
8697
|
list = [].concat(((_filterThemeData_header = filterThemeData.header) == null ? void 0 : _filterThemeData_header.btnList) || [], (_filterThemeData_footer_btnList = (_filterThemeData_footer = filterThemeData.footer) == null ? void 0 : _filterThemeData_footer.btnList) != null ? _filterThemeData_footer_btnList : []);
|
|
10375
8698
|
// FIXME: 这个逻辑实际上是有问题的
|
|
10376
8699
|
_needTimeLine = list.some(function(item) {
|
|
10377
|
-
|
|
10378
|
-
return REC_GROUP((_theme_options = theme.options) == null ? void 0 : _theme_options.sdkType).includes(item.iconId);
|
|
8700
|
+
return REC_GROUP.includes(item.iconId);
|
|
10379
8701
|
});
|
|
10380
8702
|
// PC 单独渲染timeLine
|
|
10381
8703
|
if (!Utils.isMobile && !(theme.options.timeLineOptions === null || theme.options.disabledTimeLine) && _needTimeLine) {
|
|
@@ -10403,8 +8725,8 @@ function _renderTheme(theme, data) {
|
|
|
10403
8725
|
}
|
|
10404
8726
|
if (theme.options.recOptions !== null && ((_theme_options_mobileExtendOptions2 = theme.options.mobileExtendOptions) == null ? void 0 : _theme_options_mobileExtendOptions2.controls.includes('rec')) && _needTimeLine) {
|
|
10405
8727
|
[].concat(((_filterThemeData_header1 = filterThemeData.header) == null ? void 0 : _filterThemeData_header1.btnList) || [], (_filterThemeData_footer_btnList1 = (_filterThemeData_footer1 = filterThemeData.footer) == null ? void 0 : _filterThemeData_footer1.btnList) != null ? _filterThemeData_footer_btnList1 : []).forEach(function(item) {
|
|
10406
|
-
var
|
|
10407
|
-
if (REC_GROUP
|
|
8728
|
+
var _theme__mobileExtend;
|
|
8729
|
+
if (REC_GROUP.includes(item.iconId)) _renderRecType(theme, (_theme__mobileExtend = theme._mobileExtend) == null ? void 0 : _theme__mobileExtend.$topRight, item.iconId, props);
|
|
10408
8730
|
});
|
|
10409
8731
|
}
|
|
10410
8732
|
if ((theme.options.timeLineOptions !== null || !theme.options.disabledTimeLine) && ((_theme_options_mobileExtendOptions3 = theme.options.mobileExtendOptions) == null ? void 0 : _theme_options_mobileExtendOptions3.controls.includes('timeLine')) && _needTimeLine) {
|
|
@@ -10766,13 +9088,13 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10766
9088
|
_this._initOptions(options);
|
|
10767
9089
|
if (_this.options.type === 'ezopen') {
|
|
10768
9090
|
var _this_urlInfo_searchParams, _this_urlInfo;
|
|
10769
|
-
_this.urlInfo =
|
|
9091
|
+
_this.urlInfo = utilsTools.parseEzopenUrl(_this.options.url);
|
|
10770
9092
|
if ((_this_urlInfo = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams = _this_urlInfo.searchParams) == null ? void 0 : _this_urlInfo_searchParams.spaceId) {
|
|
10771
9093
|
_this.options.spaceId = _this.urlInfo.searchParams.spaceId;
|
|
10772
9094
|
}
|
|
10773
9095
|
if (_this.urlInfo.type === 'rec') {
|
|
10774
9096
|
var _this_urlInfo_searchParams1, _this_urlInfo1, _this_urlInfo_searchParams2, _this_urlInfo2;
|
|
10775
|
-
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ?
|
|
9097
|
+
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ? utilsTools.DateTime.toDate((_this_urlInfo2 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams2 = _this_urlInfo2.searchParams) == null ? void 0 : _this_urlInfo_searchParams2.begin) : utilsTools.DateTime.toDate(utilsTools.DateTime.format(new Date(), 'YYYY/MM/DD') + ' 00:00:00');
|
|
10776
9098
|
}
|
|
10777
9099
|
}
|
|
10778
9100
|
_this._getRecType(_this.options.url);
|
|
@@ -11547,7 +9869,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
11547
9869
|
* @returns {"rec" | "cloudRecord" | "cloudRec" | ""} 录像类型, rec: 录像, cloudRec: 云录像, cloudRecord: 云录制
|
|
11548
9870
|
*/ _proto._getRecType = function _getRecType(url) {
|
|
11549
9871
|
if (this.options.type === 'ezopen' && /^ezopen:\/\//.test(url)) {
|
|
11550
|
-
var urlInfo =
|
|
9872
|
+
var urlInfo = utilsTools.parseEzopenUrl(url);
|
|
11551
9873
|
if (urlInfo.type === 'rec') {
|
|
11552
9874
|
var _urlInfo_searchParams;
|
|
11553
9875
|
if (urlInfo.recType === 'cloud' && (urlInfo == null ? void 0 : (_urlInfo_searchParams = urlInfo.searchParams) == null ? void 0 : _urlInfo_searchParams.busType) === '7') {
|
|
@@ -12012,7 +10334,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
12012
10334
|
zh: zh,
|
|
12013
10335
|
en: en
|
|
12014
10336
|
};
|
|
12015
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '
|
|
10337
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.0.0-beta.1';
|
|
12016
10338
|
|
|
12017
10339
|
exports.Control = Control;
|
|
12018
10340
|
exports.EVENTS = EVENTS;
|