|
@@ -3027,11 +3027,8 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
|
if (!_this._ctx) {
|
|
|
return;
|
|
|
}
|
|
|
- var row = keyframeViewModel.rowViewModel.model;
|
|
|
var size = keyframeViewModel.size;
|
|
|
- var keyframe = keyframeViewModel.model;
|
|
|
if (size) {
|
|
|
- var _keyframeViewModel$gr;
|
|
|
var x = _this._getSharp(size.x);
|
|
|
var y = size.y;
|
|
|
var bounds = _this._cutBounds({
|
|
@@ -3044,69 +3041,79 @@ var Timeline = /*#__PURE__*/function (_TimelineEventsEmitte) {
|
|
|
return;
|
|
|
}
|
|
|
_this._ctx.save();
|
|
|
-
|
|
|
- // Performance FIX: use clip only when we are in the collision! Clip is slow!
|
|
|
- // Other keyframes should be hidden by bounds check.
|
|
|
- // Note: clip with just render part of the keyframe
|
|
|
- if (bounds && bounds.overlapY) {
|
|
|
- _this._ctx.beginPath();
|
|
|
- _this._ctx.rect(0, TimelineStyleUtils.headerHeight(_this._options), _this._canvasClientWidth(), _this._canvasClientWidth());
|
|
|
- _this._ctx.clip();
|
|
|
- }
|
|
|
- var shape = keyframeViewModel.shape;
|
|
|
- if (shape === TimelineKeyframeShape.None) {
|
|
|
- return;
|
|
|
- }
|
|
|
- var rowStyle = row.style || null;
|
|
|
- var groupModel = (keyframeViewModel === null || keyframeViewModel === void 0 || (_keyframeViewModel$gr = keyframeViewModel.groupViewModel) === null || _keyframeViewModel$gr === void 0 ? void 0 : _keyframeViewModel$gr.groupModel) || null;
|
|
|
- var keyframeColor = keyframe.selected ? TimelineStyleUtils.keyframeSelectedFillColor(keyframe, groupModel, rowStyle, _this._options) : TimelineStyleUtils.keyframeFillColor(keyframe, groupModel, rowStyle, _this._options);
|
|
|
- var border = TimelineStyleUtils.keyframeStrokeThickness(keyframe, groupModel, rowStyle, _this._options);
|
|
|
- var strokeColor = '';
|
|
|
- if (border > 0) {
|
|
|
- if (keyframe.selected) {
|
|
|
- strokeColor = TimelineStyleUtils.keyframeSelectedStrokeColor(keyframe, groupModel, rowStyle, _this._options);
|
|
|
- } else {
|
|
|
- strokeColor = TimelineStyleUtils.keyframeStrokeColor(keyframe, groupModel, rowStyle, _this._options);
|
|
|
- }
|
|
|
- }
|
|
|
- if (shape == TimelineKeyframeShape.Rhomb) {
|
|
|
- _this._ctx.beginPath();
|
|
|
- _this._ctx.translate(x, y);
|
|
|
- _this._ctx.rotate(45 * Math.PI / 180);
|
|
|
- if (border > 0 && strokeColor) {
|
|
|
- _this._ctx.fillStyle = strokeColor;
|
|
|
- _this._ctx.rect(-size.width / 2, -size.height / 2, size.width, size.height);
|
|
|
- _this._ctx.fill();
|
|
|
+ try {
|
|
|
+ // Performance FIX: use clip only when we are in the collision! Clip is slow!
|
|
|
+ // Other keyframes should be hidden by bounds check.
|
|
|
+ // Note: clip with just render part of the keyframe
|
|
|
+ if (bounds && bounds.overlapY) {
|
|
|
+ _this._ctx.beginPath();
|
|
|
+ _this._ctx.rect(0, TimelineStyleUtils.headerHeight(_this._options), _this._canvasClientWidth(), _this._canvasClientWidth());
|
|
|
+ _this._ctx.clip();
|
|
|
}
|
|
|
- _this._ctx.fillStyle = keyframeColor;
|
|
|
- // draw main keyframe data with offset.
|
|
|
- _this._ctx.translate(border, border);
|
|
|
- _this._ctx.rect(-size.width / 2, -size.height / 2, size.width - border * 2, size.height - border * 2);
|
|
|
- _this._ctx.fill();
|
|
|
- } else if (shape == TimelineKeyframeShape.Circle) {
|
|
|
- _this._ctx.beginPath();
|
|
|
- if (border > 0 && strokeColor) {
|
|
|
- _this._ctx.fillStyle = strokeColor;
|
|
|
- _this._ctx.arc(x, y, size.height, 0, 2 * Math.PI);
|
|
|
- }
|
|
|
- _this._ctx.fillStyle = keyframeColor;
|
|
|
- _this._ctx.arc(x, y, size.height - border, 0, 2 * Math.PI);
|
|
|
- _this._ctx.fill();
|
|
|
- } else if (shape == TimelineKeyframeShape.Rect) {
|
|
|
- _this._ctx.beginPath();
|
|
|
- if (border > 0 && strokeColor) {
|
|
|
- _this._ctx.fillStyle = strokeColor;
|
|
|
- _this._ctx.rect(x, y, size.width, size.height);
|
|
|
- _this._ctx.fill();
|
|
|
- }
|
|
|
- _this._ctx.fillStyle = keyframeColor;
|
|
|
- _this._ctx.rect(x + border, y + border, size.width - border, size.height - border);
|
|
|
- _this._ctx.fill();
|
|
|
- }
|
|
|
+ _this._renderKeyframe(_this._ctx, keyframeViewModel);
|
|
|
+ } finally {}
|
|
|
_this._ctx.restore();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ timeline_defineProperty(_this, "_renderKeyframe", function (ctx, keyframeViewModel) {
|
|
|
+ var _keyframeViewModel$gr;
|
|
|
+ var shape = keyframeViewModel.shape;
|
|
|
+ if (shape === TimelineKeyframeShape.None) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var size = keyframeViewModel.size;
|
|
|
+ var x = _this._getSharp(size.x);
|
|
|
+ var y = size.y;
|
|
|
+ var keyframe = keyframeViewModel.model;
|
|
|
+ var row = keyframeViewModel.rowViewModel.model;
|
|
|
+ var rowStyle = row.style || null;
|
|
|
+ var groupModel = (keyframeViewModel === null || keyframeViewModel === void 0 || (_keyframeViewModel$gr = keyframeViewModel.groupViewModel) === null || _keyframeViewModel$gr === void 0 ? void 0 : _keyframeViewModel$gr.groupModel) || null;
|
|
|
+ var keyframeColor = keyframe.selected ? TimelineStyleUtils.keyframeSelectedFillColor(keyframe, groupModel, rowStyle, _this._options) : TimelineStyleUtils.keyframeFillColor(keyframe, groupModel, rowStyle, _this._options);
|
|
|
+ var border = TimelineStyleUtils.keyframeStrokeThickness(keyframe, groupModel, rowStyle, _this._options);
|
|
|
+ var strokeColor = '';
|
|
|
+ if (border > 0) {
|
|
|
+ if (keyframe.selected) {
|
|
|
+ strokeColor = TimelineStyleUtils.keyframeSelectedStrokeColor(keyframe, groupModel, rowStyle, _this._options);
|
|
|
+ } else {
|
|
|
+ strokeColor = TimelineStyleUtils.keyframeStrokeColor(keyframe, groupModel, rowStyle, _this._options);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (shape == TimelineKeyframeShape.Rhomb) {
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.translate(x, y);
|
|
|
+ ctx.rotate(45 * Math.PI / 180);
|
|
|
+ if (border > 0 && strokeColor) {
|
|
|
+ ctx.fillStyle = strokeColor;
|
|
|
+ ctx.rect(-size.width / 2, -size.height / 2, size.width, size.height);
|
|
|
+ ctx.fill();
|
|
|
+ }
|
|
|
+ ctx.fillStyle = keyframeColor;
|
|
|
+ // draw main keyframe data with offset.
|
|
|
+ ctx.translate(border, border);
|
|
|
+ ctx.rect(-size.width / 2, -size.height / 2, size.width - border * 2, size.height - border * 2);
|
|
|
+ ctx.fill();
|
|
|
+ } else if (shape == TimelineKeyframeShape.Circle) {
|
|
|
+ ctx.beginPath();
|
|
|
+ if (border > 0 && strokeColor) {
|
|
|
+ ctx.fillStyle = strokeColor;
|
|
|
+ ctx.arc(x, y, size.height, 0, 2 * Math.PI);
|
|
|
+ }
|
|
|
+ ctx.fillStyle = keyframeColor;
|
|
|
+ ctx.arc(x, y, size.height - border, 0, 2 * Math.PI);
|
|
|
+ ctx.fill();
|
|
|
+ } else if (shape == TimelineKeyframeShape.Rect) {
|
|
|
+ ctx.beginPath();
|
|
|
+ if (border > 0 && strokeColor) {
|
|
|
+ ctx.fillStyle = strokeColor;
|
|
|
+ ctx.rect(x, y, size.width, size.height);
|
|
|
+ ctx.fill();
|
|
|
+ }
|
|
|
+ ctx.fillStyle = keyframeColor;
|
|
|
+ ctx.rect(x + border, y + border, size.width - border, size.height - border);
|
|
|
+ ctx.fill();
|
|
|
+ }
|
|
|
+ });
|
|
|
timeline_defineProperty(_this, "_renderSelectionRect", function () {
|
|
|
if (_this._drag || !_this._ctx || !_this._canvas) {
|
|
|
return;
|