1 | /**
|
2 | * Module, defining Axis Renderer for horizontal 3D axes.
|
3 | */
|
4 | import { __extends } from "tslib";
|
5 | /**
|
6 | * ============================================================================
|
7 | * IMPORTS
|
8 | * ============================================================================
|
9 | * @hidden
|
10 | */
|
11 | import { AxisRendererX } from "../axes/AxisRendererX";
|
12 | import { MutableValueDisposer } from "../../core/utils/Disposer";
|
13 | import { registry } from "../../core/Registry";
|
14 | import * as $path from "../../core/rendering/Path";
|
15 | /**
|
16 | * ============================================================================
|
17 | * MAIN CLASS
|
18 | * ============================================================================
|
19 | * @hidden
|
20 | */
|
21 | /**
|
22 | * Renderer for horizontal 3D axis.
|
23 | *
|
24 | * @see {@link IAxisRendererX3DEvents} for a list of available events
|
25 | * @see {@link IAxisRendererX3DAdapters} for a list of available Adapters
|
26 | */
|
27 | var AxisRendererX3D = /** @class */ (function (_super) {
|
28 | __extends(AxisRendererX3D, _super);
|
29 | /**
|
30 | * Constructor.
|
31 | *
|
32 | * @param axis Related axis
|
33 | */
|
34 | function AxisRendererX3D() {
|
35 | var _this = _super.call(this) || this;
|
36 | /**
|
37 | * A related chart.
|
38 | *
|
39 | * @todo Description
|
40 | */
|
41 | _this._chart = new MutableValueDisposer();
|
42 | _this.className = "AxisRendererX3D";
|
43 | _this._disposers.push(_this._chart);
|
44 | _this.applyTheme();
|
45 | return _this;
|
46 | }
|
47 | /**
|
48 | * Updates and positions a grid element.
|
49 | *
|
50 | * @ignore Exclude from docs
|
51 | * @param grid Grid element
|
52 | * @param position Starting position
|
53 | * @param endPosition End position
|
54 | */
|
55 | AxisRendererX3D.prototype.updateGridElement = function (grid, position, endPosition) {
|
56 | position = position + (endPosition - position) * grid.location;
|
57 | var point = this.positionToPoint(position);
|
58 | if (grid.element) {
|
59 | var dx = this.chart.dx3D || 0;
|
60 | var dy = this.chart.dy3D || 0;
|
61 | var h = this.getHeight();
|
62 | grid.path = $path.moveTo({ x: dx, y: dy }) + $path.lineTo({ x: dx, y: h + dy }) + $path.lineTo({ x: 0, y: h });
|
63 | }
|
64 | this.positionItem(grid, point);
|
65 | this.toggleVisibility(grid, position, 0, 1);
|
66 | };
|
67 | /**
|
68 | * Updates and positions the base grid element.
|
69 | *
|
70 | * @ignore Exclude from docs
|
71 | */
|
72 | AxisRendererX3D.prototype.updateBaseGridElement = function () {
|
73 | _super.prototype.updateBaseGridElement.call(this);
|
74 | var h = this.getHeight();
|
75 | var dx = this.chart.dx3D || 0;
|
76 | var dy = this.chart.dy3D || 0;
|
77 | this.baseGrid.path = $path.moveTo({ x: dx, y: dy }) + $path.lineTo({ x: 0, y: 0 }) + $path.lineTo({ x: 0, y: h });
|
78 | };
|
79 | Object.defineProperty(AxisRendererX3D.prototype, "chart", {
|
80 | /**
|
81 | * @ignore Exclude from docs
|
82 | * @return Chart
|
83 | */
|
84 | get: function () {
|
85 | return this._chart.get();
|
86 | },
|
87 | /**
|
88 | * Chart, associated with the Axis.
|
89 | *
|
90 | * @ignore Exclude from docs
|
91 | * @param value Chart
|
92 | */
|
93 | set: function (chart) {
|
94 | if (chart) {
|
95 | this._chart.set(chart, chart.events.on("propertychanged", this.handle3DChanged, this, false));
|
96 | }
|
97 | },
|
98 | enumerable: true,
|
99 | configurable: true
|
100 | });
|
101 | /**
|
102 | * Invoked when 3D-related settings change, like depth or angle.
|
103 | *
|
104 | * @param event Event
|
105 | */
|
106 | AxisRendererX3D.prototype.handle3DChanged = function (event) {
|
107 | if (event.property == "depth" || event.property == "angle") {
|
108 | this.invalidate();
|
109 | }
|
110 | };
|
111 | return AxisRendererX3D;
|
112 | }(AxisRendererX));
|
113 | export { AxisRendererX3D };
|
114 | /**
|
115 | * Register class in system, so that it can be instantiated using its name from
|
116 | * anywhere.
|
117 | *
|
118 | * @ignore
|
119 | */
|
120 | registry.registeredClasses["AxisRendererX3D"] = AxisRendererX3D;
|
121 | //# sourceMappingURL=AxisRendererX3D.js.map |
\ | No newline at end of file |