/** * Binds this manipulator to the specified SVG rect. * * @param element The SVG rect this manipulator is applied to. * @return The root element of the manipulator */ @Override public OMSVGElement bind(Record record) { this.record = record; SVGViewBoxElementModel model = (SVGViewBoxElementModel) record.getModel(); mode = Mode.PASSIVE; // Create the graphical representations for the manipulator // The manipulator has the following SVG structure // <g> // <rect/> position // <g> // <rect/> top-left corner // <rect/> bottom-right corner // </g> // </g> OMSVGRectElement rect = (OMSVGRectElement) model.getElementWrapper(); svg = rect.getOwnerSVGElement(); OMSVGDocument document = (OMSVGDocument) svg.getOwnerDocument(); g = document.createSVGGElement(); g.setClassNameBaseVal(AppBundle.INSTANCE.css().rectGeometryManipulator()); posHandle = document.createSVGRectElement(); OMSVGGElement handleGroup = document.createSVGGElement(); topLeftHandle = document.createSVGRectElement(); bottomRightHandle = document.createSVGRectElement(); g.appendChild(posHandle); g.appendChild(handleGroup); handleGroup.appendChild(topLeftHandle); handleGroup.appendChild(bottomRightHandle); monitorModel = true; model.addChangeListener(this); scheduleInit(); return g; }