text: "use strict";
  /********************************************************************************
   * Copyright (c) 2017-2018 TypeFox and others.
   *
   * This program and the accompanying materials are made available under the
   * terms of the Eclipse Public License v. 2.0 which is available at
   * http://www.eclipse.org/legal/epl-2.0.
   *
   * This Source Code may also be made available under the following Secondary
   * Licenses when the conditions for such availability set forth in the Eclipse
   * Public License v. 2.0 are satisfied: GNU General Public License, version 2
   * with the GNU Classpath Exception which is available at
   * https://www.gnu.org/software/classpath/license.html.
   *
   * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
   ********************************************************************************/
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  /** @jsx svg */
  var snabbdom_jsx_1 = require("snabbdom-jsx");
  var sgraph_1 = require("../graph/sgraph");
  var geometry_1 = require("../utils/geometry");
  var inversify_1 = require("inversify");
  var SvgViewportView = /** @class */ (function () {
      function SvgViewportView() {
      }
      SvgViewportView.prototype.render = function (model, context) {
          var transform = "scale(" + model.zoom + ") translate(" + -model.scroll.x + "," + -model.scroll.y + ")";
          return snabbdom_jsx_1.svg("svg", null,
              snabbdom_jsx_1.svg("g", { transform: transform }, context.renderChildren(model)));
      };
      SvgViewportView = __decorate([
          inversify_1.injectable()
      ], SvgViewportView);
      return SvgViewportView;
  }());
  exports.SvgViewportView = SvgViewportView;
  var CircularNodeView = /** @class */ (function () {
      function CircularNodeView() {
      }
      CircularNodeView.prototype.render = function (node, context) {
          var radius = this.getRadius(node);
          return snabbdom_jsx_1.svg("g", null,
              snabbdom_jsx_1.svg("circle", { "class-sprotty-node": node instanceof sgraph_1.SNode, "class-sprotty-port": node instanceof sgraph_1.SPort, "class-mouseover": node.hoverFeedback, "class-selected": node.selected, r: radius, cx: radius, cy: radius }),
              context.renderChildren(node));
      };
      CircularNodeView.prototype.getRadius = function (node) {
          var d = Math.min(node.size.width, node.size.height);
          return d > 0 ? d / 2 : 0;
      };
      CircularNodeView = __decorate([
          inversify_1.injectable()
      ], CircularNodeView);
      return CircularNodeView;
  }());
  exports.CircularNodeView = CircularNodeView;
  var RectangularNodeView = /** @class */ (function () {
      function RectangularNodeView() {
      }
      RectangularNodeView.prototype.render = function (node, context) {
          return snabbdom_jsx_1.svg("g", null,
              snabbdom_jsx_1.svg("rect", { "class-sprotty-node": node instanceof sgraph_1.SNode, "class-sprotty-port": node instanceof sgraph_1.SPort, "class-mouseover": node.hoverFeedback, "class-selected": node.selected, x: "0", y: "0", width: Math.max(node.size.width, 0), height: Math.max(node.size.height, 0) }),
              context.renderChildren(node));
      };
      RectangularNodeView = __decorate([
          inversify_1.injectable()
      ], RectangularNodeView);
      return RectangularNodeView;
  }());
  exports.RectangularNodeView = RectangularNodeView;
  var DiamondNodeView = /** @class */ (function () {
      function DiamondNodeView() {
      }
      DiamondNodeView.prototype.render = function (node, context) {
          var diamond = new geometry_1.Diamond({ height: Math.max(node.size.height, 0), width: Math.max(node.size.width, 0), x: 0, y: 0 });
          var points = svgStr(diamond.topPoint) + " " + svgStr(diamond.rightPoint) + " " + svgStr(diamond.bottomPoint) + " " + svgStr(diamond.leftPoint);
          return snabbdom_jsx_1.svg("g", null,
              snabbdom_jsx_1.svg("polygon", { "class-sprotty-node": node instanceof sgraph_1.SNode, "class-sprotty-port": node instanceof sgraph_1.SPort, "class-mouseover": node.hoverFeedback, "class-selected": node.selected, points: points }),
              context.renderChildren(node));
      };
      DiamondNodeView = __decorate([
          inversify_1.injectable()
      ], DiamondNodeView);
      return DiamondNodeView;
  }());
  exports.DiamondNodeView = DiamondNodeView;
  function svgStr(point) {
      return point.x + "," + point.y;
  }
  var EmptyGroupView = /** @class */ (function () {
      function EmptyGroupView() {
      }
      EmptyGroupView.prototype.render = function (node, context) {
          return snabbdom_jsx_1.svg("g", null);
      };
      EmptyGroupView = __decorate([
          inversify_1.injectable()
      ], EmptyGroupView);
      return EmptyGroupView;
  }());
  exports.EmptyGroupView = EmptyGroupView;
  //# sourceMappingURL=svg-views.js.map