|
@@ -171,7 +171,7 @@ function timelineUtils_createClass(e, r, t) { return r && timelineUtils_definePr
|
|
function timelineUtils_defineProperty(e, r, t) { return (r = timelineUtils_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
function timelineUtils_defineProperty(e, r, t) { return (r = timelineUtils_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
function timelineUtils_toPropertyKey(t) { var i = timelineUtils_toPrimitive(t, "string"); return "symbol" == timelineUtils_typeof(i) ? i : i + ""; }
|
|
function timelineUtils_toPropertyKey(t) { var i = timelineUtils_toPrimitive(t, "string"); return "symbol" == timelineUtils_typeof(i) ? i : i + ""; }
|
|
function timelineUtils_toPrimitive(t, r) { if ("object" != timelineUtils_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != timelineUtils_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
function timelineUtils_toPrimitive(t, r) { if ("object" != timelineUtils_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != timelineUtils_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
-var denominators = [1, 2, 5, 10];
|
|
|
|
|
|
+var defaultDenominators = [1, 2, 5, 10];
|
|
var TimelineUtils = /*#__PURE__*/function () {
|
|
var TimelineUtils = /*#__PURE__*/function () {
|
|
function TimelineUtils() {
|
|
function TimelineUtils() {
|
|
timelineUtils_classCallCheck(this, TimelineUtils);
|
|
timelineUtils_classCallCheck(this, TimelineUtils);
|
|
@@ -224,6 +224,10 @@ var TimelineUtils = /*#__PURE__*/function () {
|
|
key: "findGoodStep",
|
|
key: "findGoodStep",
|
|
value: function findGoodStep(originalStep) {
|
|
value: function findGoodStep(originalStep) {
|
|
var divisionCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
var divisionCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
|
|
+ var denominators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDenominators;
|
|
|
|
+ if (!denominators) {
|
|
|
|
+ denominators = defaultDenominators;
|
|
|
|
+ }
|
|
if (originalStep <= 0 || isNaN(originalStep) || !Number.isFinite(originalStep)) {
|
|
if (originalStep <= 0 || isNaN(originalStep) || !Number.isFinite(originalStep)) {
|
|
return originalStep;
|
|
return originalStep;
|
|
}
|
|
}
|
|
@@ -2546,14 +2550,10 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
* @param isSeconds whether seconds are passed.
|
|
* @param isSeconds whether seconds are passed.
|
|
*/
|
|
*/
|
|
timeline_defineProperty(_this, "_formatUnitsText", function (ms) {
|
|
timeline_defineProperty(_this, "_formatUnitsText", function (ms) {
|
|
- var isSeconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
|
|
var sign = TimelineUtils.sign(ms) < 0 ? '-' : '';
|
|
var sign = TimelineUtils.sign(ms) < 0 ? '-' : '';
|
|
ms = Math.abs(ms);
|
|
ms = Math.abs(ms);
|
|
// 1- Convert to seconds:
|
|
// 1- Convert to seconds:
|
|
var seconds = ms / 1000;
|
|
var seconds = ms / 1000;
|
|
- if (isSeconds) {
|
|
|
|
- seconds = ms;
|
|
|
|
- }
|
|
|
|
var year = Math.floor(seconds / (365 * 86400));
|
|
var year = Math.floor(seconds / (365 * 86400));
|
|
seconds = seconds % (365 * 86400);
|
|
seconds = seconds % (365 * 86400);
|
|
var days = Math.floor(seconds / 86400);
|
|
var days = Math.floor(seconds / 86400);
|
|
@@ -2596,6 +2596,7 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
* Render line gauge ticks.
|
|
* Render line gauge ticks.
|
|
*/
|
|
*/
|
|
timeline_defineProperty(_this, "_renderTicks", function () {
|
|
timeline_defineProperty(_this, "_renderTicks", function () {
|
|
|
|
+ var _this$_options7;
|
|
if (!_this._ctx || !_this._ctx.canvas || _this._ctx.canvas.clientWidth <= 0 || _this._ctx.canvas.clientHeight <= 0 || !_this._options || !_this._options.stepPx) {
|
|
if (!_this._ctx || !_this._ctx.canvas || _this._ctx.canvas.clientWidth <= 0 || _this._ctx.canvas.clientHeight <= 0 || !_this._options || !_this._options.stepPx) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -2616,8 +2617,8 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
}
|
|
}
|
|
|
|
|
|
// Find the nearest 'beautiful' step for a gauge.
|
|
// Find the nearest 'beautiful' step for a gauge.
|
|
- // 'beautiful' step should be dividable by 1/2/5/10!
|
|
|
|
- var step = TimelineUtils.findGoodStep(valDistance / (screenWidth / _this._options.stepPx));
|
|
|
|
|
|
+ // 'beautiful' step. Ex: should be dividable by 1/2/5/10!
|
|
|
|
+ var step = TimelineUtils.findGoodStep(valDistance / (screenWidth / _this._options.stepPx), 0, (_this$_options7 = _this._options) === null || _this$_options7 === void 0 ? void 0 : _this$_options7.denominators);
|
|
|
|
|
|
// Find beautiful start point:
|
|
// Find beautiful start point:
|
|
var fromVal = Math.floor(from / step) * step;
|
|
var fromVal = Math.floor(from / step) * step;
|
|
@@ -2629,7 +2630,8 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
}
|
|
}
|
|
var smallStep = 0;
|
|
var smallStep = 0;
|
|
if (_this._options.stepSmallPx) {
|
|
if (_this._options.stepSmallPx) {
|
|
- smallStep = TimelineUtils.findGoodStep(valDistance / (screenWidth / _this._options.stepSmallPx));
|
|
|
|
|
|
+ var _this$_options8;
|
|
|
|
+ smallStep = TimelineUtils.findGoodStep(valDistance / (screenWidth / _this._options.stepSmallPx), 0, (_this$_options8 = _this._options) === null || _this$_options8 === void 0 ? void 0 : _this$_options8.denominators);
|
|
}
|
|
}
|
|
var lastTextStart = 0;
|
|
var lastTextStart = 0;
|
|
_this._ctx.save();
|
|
_this._ctx.save();
|
|
@@ -3051,8 +3053,9 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
_this._ctx.clip();
|
|
_this._ctx.clip();
|
|
}
|
|
}
|
|
_this._renderKeyframe(_this._ctx, keyframeViewModel);
|
|
_this._renderKeyframe(_this._ctx, keyframeViewModel);
|
|
- } finally {}
|
|
|
|
- _this._ctx.restore();
|
|
|
|
|
|
+ } finally {
|
|
|
|
+ _this._ctx.restore();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -3178,8 +3181,8 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
* Render timeline cap top.
|
|
* Render timeline cap top.
|
|
*/
|
|
*/
|
|
timeline_defineProperty(_this, "_renderTimelineCap", function (timeLinePos, y) {
|
|
timeline_defineProperty(_this, "_renderTimelineCap", function (timeLinePos, y) {
|
|
- var _this$_options7;
|
|
|
|
- var capStyle = (_this$_options7 = _this._options) === null || _this$_options7 === void 0 || (_this$_options7 = _this$_options7.timelineStyle) === null || _this$_options7 === void 0 ? void 0 : _this$_options7.capStyle;
|
|
|
|
|
|
+ var _this$_options9;
|
|
|
|
+ var capStyle = (_this$_options9 = _this._options) === null || _this$_options9 === void 0 || (_this$_options9 = _this$_options9.timelineStyle) === null || _this$_options9 === void 0 ? void 0 : _this$_options9.capStyle;
|
|
if (!_this._ctx || !capStyle) {
|
|
if (!_this._ctx || !capStyle) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -3524,8 +3527,8 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
} else if (element.type === TimelineElementType.Timeline) {
|
|
} else if (element.type === TimelineElementType.Timeline) {
|
|
- var _this$_options8;
|
|
|
|
- if (((_this$_options8 = _this._options) === null || _this$_options8 === void 0 ? void 0 : _this$_options8.timelineDraggable) === false) {
|
|
|
|
|
|
+ var _this$_options10;
|
|
|
|
+ if (((_this$_options10 = _this._options) === null || _this$_options10 === void 0 ? void 0 : _this$_options10.timelineDraggable) === false) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
} else if (element.type === TimelineElementType.Row) {
|
|
} else if (element.type === TimelineElementType.Row) {
|
|
@@ -3579,7 +3582,7 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
* get all clickable elements by the given local screen coordinate.
|
|
* get all clickable elements by the given local screen coordinate.
|
|
*/
|
|
*/
|
|
timeline_defineProperty(_this, "elementFromPoint", function (pos, clickRadius, onlyTypes) {
|
|
timeline_defineProperty(_this, "elementFromPoint", function (pos, clickRadius, onlyTypes) {
|
|
- var _this$_options9;
|
|
|
|
|
|
+ var _this$_options11;
|
|
clickRadius = Math.max(clickRadius, 1);
|
|
clickRadius = Math.max(clickRadius, 1);
|
|
var toReturn = [];
|
|
var toReturn = [];
|
|
if (!pos) {
|
|
if (!pos) {
|
|
@@ -3589,7 +3592,7 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
// Check whether we can drag timeline.
|
|
// Check whether we can drag timeline.
|
|
var timeLinePos = _this._toScreenPx(_this._val);
|
|
var timeLinePos = _this._toScreenPx(_this._val);
|
|
var width = 0;
|
|
var width = 0;
|
|
- var timelineStyle = (_this$_options9 = _this._options) === null || _this$_options9 === void 0 ? void 0 : _this$_options9.timelineStyle;
|
|
|
|
|
|
+ var timelineStyle = (_this$_options11 = _this._options) === null || _this$_options11 === void 0 ? void 0 : _this$_options11.timelineStyle;
|
|
if (timelineStyle) {
|
|
if (timelineStyle) {
|
|
var _timelineStyle$capSty;
|
|
var _timelineStyle$capSty;
|
|
width = Math.max((timelineStyle.width || 1) * _this._pixelRatio, ((timelineStyle === null || timelineStyle === void 0 || (_timelineStyle$capSty = timelineStyle.capStyle) === null || _timelineStyle$capSty === void 0 ? void 0 : _timelineStyle$capSty.width) || 0) * _this._pixelRatio || 1) + clickRadius;
|
|
width = Math.max((timelineStyle.width || 1) * _this._pixelRatio, ((timelineStyle === null || timelineStyle === void 0 || (_timelineStyle$capSty = timelineStyle.capStyle) === null || _timelineStyle$capSty === void 0 ? void 0 : _timelineStyle$capSty.width) || 0) * _this._pixelRatio || 1) + clickRadius;
|