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