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