@daign/2d-pipeline
Version:
Two dimensional graphics pipeline.
59 lines (58 loc) • 2.21 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphicNode = void 0;
var genericNode_1 = require("./genericNode");
var transformations_1 = require("./transformations");
/**
* Class for nodes in a graphic document.
*/
var GraphicNode = /** @class */ (function (_super) {
__extends(GraphicNode, _super);
/**
* Constructor.
*/
function GraphicNode() {
var _this = _super.call(this) || this;
/**
* The transformation applied to the node.
*/
_this.transformation = new transformations_1.TransformCollection();
/**
* The presentation node copies that originated from this graphic node.
*/
_this.presentationNodes = [];
return _this;
}
/**
* Add a node to the list of known presentation node copies of this node.
*/
GraphicNode.prototype.registerPresentationNode = function (presentationNode) {
this.presentationNodes.push(presentationNode);
};
/**
* Remove a node from the list of known presentation node copies of this node.
*/
GraphicNode.prototype.removePresentationNode = function (presentationNode) {
var i = this.presentationNodes.indexOf(presentationNode);
if (i > -1) {
this.presentationNodes.splice(i, 1);
}
};
return GraphicNode;
}(genericNode_1.GenericNode));
exports.GraphicNode = GraphicNode;