|
@@ -207,7 +207,7 @@ var TimelineEventsEmitter = /*#__PURE__*/function () {
|
|
function TimelineEventsEmitter() {
|
|
function TimelineEventsEmitter() {
|
|
_classCallCheck(this, TimelineEventsEmitter);
|
|
_classCallCheck(this, TimelineEventsEmitter);
|
|
|
|
|
|
- _defineProperty(this, "subscriptions", []);
|
|
|
|
|
|
+ _defineProperty(this, "_subscriptions", []);
|
|
}
|
|
}
|
|
|
|
|
|
_createClass(TimelineEventsEmitter, [{
|
|
_createClass(TimelineEventsEmitter, [{
|
|
@@ -218,7 +218,7 @@ var TimelineEventsEmitter = /*#__PURE__*/function () {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- this.subscriptions.push({
|
|
|
|
|
|
+ this._subscriptions.push({
|
|
topic: topic,
|
|
topic: topic,
|
|
callback: callback
|
|
callback: callback
|
|
});
|
|
});
|
|
@@ -230,7 +230,7 @@ var TimelineEventsEmitter = /*#__PURE__*/function () {
|
|
}, {
|
|
}, {
|
|
key: "off",
|
|
key: "off",
|
|
value: function off(topic, callback) {
|
|
value: function off(topic, callback) {
|
|
- this.subscriptions = this.subscriptions.filter(function (event) {
|
|
|
|
|
|
+ this._subscriptions = this._subscriptions.filter(function (event) {
|
|
return event && event.callback != callback && event.topic != topic;
|
|
return event && event.callback != callback && event.topic != topic;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -241,14 +241,14 @@ var TimelineEventsEmitter = /*#__PURE__*/function () {
|
|
}, {
|
|
}, {
|
|
key: "offAll",
|
|
key: "offAll",
|
|
value: function offAll() {
|
|
value: function offAll() {
|
|
- this.subscriptions.length = 0;
|
|
|
|
|
|
+ this._subscriptions.length = 0;
|
|
} // emit event.
|
|
} // emit event.
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
|
|
}, {
|
|
}, {
|
|
key: "emit",
|
|
key: "emit",
|
|
value: function emit(topic, args) {
|
|
value: function emit(topic, args) {
|
|
- this.subscriptions.forEach(function (event) {
|
|
|
|
|
|
+ this._subscriptions.forEach(function (event) {
|
|
if (event && event.topic == topic && event.callback) {
|
|
if (event && event.topic == topic && event.callback) {
|
|
event.callback(args);
|
|
event.callback(args);
|
|
}
|
|
}
|
|
@@ -906,10 +906,7 @@ var timeline_Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
});
|
|
});
|
|
|
|
|
|
timeline_defineProperty(_assertThisInitialized(_this), "handleScrollEvent", function (args) {
|
|
timeline_defineProperty(_assertThisInitialized(_this), "handleScrollEvent", function (args) {
|
|
- if (_this.scrollFinishedTimerRef) {
|
|
|
|
- clearTimeout(_this.scrollFinishedTimerRef);
|
|
|
|
- _this.scrollFinishedTimerRef = null;
|
|
|
|
- } // Set a timeout to run event 'scrolling end'.
|
|
|
|
|
|
+ _this.clearScrollFinishedTimer(); // Set a timeout to run event 'scrolling end'.
|
|
|
|
|
|
|
|
|
|
_this.scrollFinishedTimerRef = setTimeout(function () {
|
|
_this.scrollFinishedTimerRef = setTimeout(function () {
|
|
@@ -1274,6 +1271,42 @@ var timeline_Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
window.addEventListener('mouseup', this.handleMouseUpEvent, false);
|
|
window.addEventListener('mouseup', this.handleMouseUpEvent, false);
|
|
window.addEventListener('touchend', this.handleMouseUpEvent, false);
|
|
window.addEventListener('touchend', this.handleMouseUpEvent, false);
|
|
}
|
|
}
|
|
|
|
+ }, {
|
|
|
|
+ key: "dispose",
|
|
|
|
+ value: function dispose() {
|
|
|
|
+ this._subscriptions = null;
|
|
|
|
+ this.container = null;
|
|
|
|
+ this.canvas = null;
|
|
|
|
+ this.scrollContainer = null;
|
|
|
|
+ this.scrollContent = null;
|
|
|
|
+ this.ctx = null;
|
|
|
|
+ this.cleanUpSelection();
|
|
|
|
+ this.container.removeEventListener('wheel', this.handleWheelEvent);
|
|
|
|
+
|
|
|
|
+ if (this.scrollContainer) {
|
|
|
|
+ this.scrollContainer.removeEventListener('scroll', this.handleScrollEvent);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ window.removeEventListener('blur', this.handleBlurEvent);
|
|
|
|
+ window.removeEventListener('resize', this.handleWindowResizeEvent);
|
|
|
|
+ document.removeEventListener('keydown', this.handleDocumentKeydownEvent);
|
|
|
|
+ this.canvas.removeEventListener('touchstart', this.handleMouseDownEvent);
|
|
|
|
+ this.canvas.removeEventListener('mousedown', this.handleMouseDownEvent);
|
|
|
|
+ window.removeEventListener('mousemove', this.handleMouseMoveEvent);
|
|
|
|
+ window.removeEventListener('touchmove', this.handleMouseMoveEvent);
|
|
|
|
+ window.removeEventListener('mouseup', this.handleMouseUpEvent);
|
|
|
|
+ window.removeEventListener('touchend', this.handleMouseUpEvent);
|
|
|
|
+ this.stopAutoPan();
|
|
|
|
+ this.clearScrollFinishedTimer();
|
|
|
|
+ }
|
|
|
|
+ }, {
|
|
|
|
+ key: "clearScrollFinishedTimer",
|
|
|
|
+ value: function clearScrollFinishedTimer() {
|
|
|
|
+ if (this.scrollFinishedTimerRef) {
|
|
|
|
+ clearTimeout(this.scrollFinishedTimerRef);
|
|
|
|
+ this.scrollFinishedTimerRef = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}, {
|
|
}, {
|
|
key: "performClick",
|
|
key: "performClick",
|
|
value: function performClick(pos, args, drag) {
|
|
value: function performClick(pos, args, drag) {
|
|
@@ -1925,7 +1958,7 @@ var timeline_Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
|
|
|
|
if (!includeStipesBounds && (!row.keyframes || !row.keyframes.forEach || row.keyframes.length <= 0)) {
|
|
if (!includeStipesBounds && (!row.keyframes || !row.keyframes.forEach || row.keyframes.length <= 0)) {
|
|
return;
|
|
return;
|
|
- } // Get min and max ms to draw keyframe lane:
|
|
|
|
|
|
+ } // Get min and max ms to draw keyframe rows:
|
|
|
|
|
|
|
|
|
|
if (row && row.keyframes) {
|
|
if (row && row.keyframes) {
|
|
@@ -2057,25 +2090,25 @@ var timeline_Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
}, {
|
|
}, {
|
|
key: "getKeyframesStripeSize",
|
|
key: "getKeyframesStripeSize",
|
|
value: function getKeyframesStripeSize(row, rowY, minValue, maxValue) {
|
|
value: function getKeyframesStripeSize(row, rowY, minValue, maxValue) {
|
|
- var keyframeLaneHeight = TimelineStyleUtils.rowStripeHeight(row, this.options.rowsStyle);
|
|
|
|
|
|
+ var stripeHeight = TimelineStyleUtils.rowStripeHeight(row, this.options.rowsStyle);
|
|
var height = TimelineStyleUtils.getRowHeight(row, this.options.rowsStyle);
|
|
var height = TimelineStyleUtils.getRowHeight(row, this.options.rowsStyle);
|
|
|
|
|
|
- if (!keyframeLaneHeight && keyframeLaneHeight !== 0 || isNaN(keyframeLaneHeight) || keyframeLaneHeight == 'auto') {
|
|
|
|
- keyframeLaneHeight = Math.floor(height * 0.8);
|
|
|
|
|
|
+ if (!stripeHeight && stripeHeight !== 0 || isNaN(stripeHeight) || stripeHeight == 'auto') {
|
|
|
|
+ stripeHeight = Math.floor(height * 0.8);
|
|
}
|
|
}
|
|
|
|
|
|
- if (keyframeLaneHeight > height) {
|
|
|
|
- keyframeLaneHeight = height;
|
|
|
|
|
|
+ if (stripeHeight > height) {
|
|
|
|
+ stripeHeight = height;
|
|
}
|
|
}
|
|
|
|
|
|
- var margin = height - keyframeLaneHeight; // draw keyframes lane.
|
|
|
|
|
|
+ var margin = height - stripeHeight; // draw keyframes rows.
|
|
|
|
|
|
var xMin = this.valToPx(minValue);
|
|
var xMin = this.valToPx(minValue);
|
|
var xMax = this.valToPx(maxValue);
|
|
var xMax = this.valToPx(maxValue);
|
|
return {
|
|
return {
|
|
x: xMin,
|
|
x: xMin,
|
|
y: rowY + Math.floor(margin / 2),
|
|
y: rowY + Math.floor(margin / 2),
|
|
- height: keyframeLaneHeight,
|
|
|
|
|
|
+ height: stripeHeight,
|
|
width: TimelineUtils.getDistance(xMin, xMax)
|
|
width: TimelineUtils.getDistance(xMin, xMax)
|
|
};
|
|
};
|
|
}
|
|
}
|
|
@@ -2516,21 +2549,34 @@ var timeline_Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
radius: radius
|
|
radius: radius
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Apply container div size to the container.
|
|
|
|
+ */
|
|
|
|
+
|
|
}, {
|
|
}, {
|
|
- key: "rescale",
|
|
|
|
- value: function rescale(newWidth, newHeight, scrollMode) {
|
|
|
|
|
|
+ key: "rescaleCanvas",
|
|
|
|
+ value: function rescaleCanvas() {
|
|
|
|
+ var changed = false;
|
|
var width = this.scrollContainer.clientWidth * this.pixelRatio;
|
|
var width = this.scrollContainer.clientWidth * this.pixelRatio;
|
|
var height = this.scrollContainer.clientHeight * this.pixelRatio;
|
|
var height = this.scrollContainer.clientHeight * this.pixelRatio;
|
|
|
|
|
|
if (Math.floor(width) != Math.floor(this.ctx.canvas.width)) {
|
|
if (Math.floor(width) != Math.floor(this.ctx.canvas.width)) {
|
|
this.ctx.canvas.width = width;
|
|
this.ctx.canvas.width = width;
|
|
|
|
+ changed = true;
|
|
}
|
|
}
|
|
|
|
|
|
if (Math.floor(height) != Math.floor(this.ctx.canvas.height)) {
|
|
if (Math.floor(height) != Math.floor(this.ctx.canvas.height)) {
|
|
this.ctx.canvas.height = height;
|
|
this.ctx.canvas.height = height;
|
|
|
|
+ changed = true;
|
|
}
|
|
}
|
|
|
|
|
|
this.ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
|
|
this.ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
|
|
|
|
+ return changed;
|
|
|
|
+ }
|
|
|
|
+ }, {
|
|
|
|
+ key: "rescale",
|
|
|
|
+ value: function rescale(newWidth, newHeight, scrollMode) {
|
|
|
|
+ this.rescaleCanvas();
|
|
var data = this.calculateRowsBounds();
|
|
var data = this.calculateRowsBounds();
|
|
|
|
|
|
if (data && data.area) {
|
|
if (data && data.area) {
|
|
@@ -2567,7 +2613,7 @@ var timeline_Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
- * Find clickable elements under the current position.
|
|
|
|
|
|
+ * Find clickable elements under the mouse position.
|
|
*/
|
|
*/
|
|
|
|
|
|
}, {
|
|
}, {
|