UNPKG

molstar

Version:

A comprehensive macromolecular library.

38 lines 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PointComponent = void 0; var tslib_1 = require("tslib"); var jsx_runtime_1 = require("react/jsx-runtime"); var React = (0, tslib_1.__importStar)(require("react")); var linear_algebra_1 = require("../../../mol-math/linear-algebra"); var PointComponent = /** @class */ (function (_super) { (0, tslib_1.__extends)(PointComponent, _super); function PointComponent(props) { var _this = _super.call(this, props) || this; _this.state = { show: false }; _this.handleHover = _this.handleHover.bind(_this); _this.handleHoverOff = _this.handleHoverOff.bind(_this); _this.deletePoint = _this.deletePoint.bind(_this); return _this; } PointComponent.prototype.handleHover = function () { this.setState({ show: true }); var point = linear_algebra_1.Vec2.create(this.props.nX, this.props.nY); this.props.onmouseover(point); }; PointComponent.prototype.handleHoverOff = function () { this.setState({ show: false }); this.props.onmouseover(undefined); }; PointComponent.prototype.deletePoint = function () { this.props.delete(this.props.id); }; PointComponent.prototype.render = function () { return ([ (0, jsx_runtime_1.jsx)("circle", { r: "10", id: "" + this.props.id, cx: this.props.x, cy: this.props.y, onClick: this.props.onclick, onDoubleClick: this.props.delete(this.props.id), onMouseEnter: this.handleHover, onMouseLeave: this.handleHoverOff, onMouseDown: this.props.onmousedown, fill: "black" }, this.props.id + "circle") ]); }; return PointComponent; }(React.Component)); exports.PointComponent = PointComponent; //# sourceMappingURL=point-component.js.map