UNPKG

@daign/2d-graphics

Version:

Two dimensional graphics library that implements the daign-2d-pipeline.

36 lines (35 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectionFrame = void 0; var basic_elements_1 = require("../basic-elements"); /** * Control guide for drawing a frame around the active object on the control layer. */ var SelectionFrame = /** @class */ (function () { /** * Constructor. */ function SelectionFrame() { } /** * Create the shapes that make up the control guide. * @param activeObject - The currently active control object. */ SelectionFrame.prototype.redraw = function (activeObject) { /* The transformation that converts from the coordinate system of the control object to view * coordinates. */ var transformation = activeObject.presentationNodes[0].projectNodeToView; // The bounding box of the active element, transformed to view coordinates. var box = activeObject.getBox(); var start = box.min.clone().transform(transformation); var end = box.max.clone().transform(transformation); // Create the basic shape of the frame. var frame = new basic_elements_1.TwoPointRectangle(); frame.addClass('selection-frame'); frame.start = start; frame.end = end; return frame; }; return SelectionFrame; }()); exports.SelectionFrame = SelectionFrame;