molstar
Version:
A comprehensive macromolecular library.
35 lines (34 loc) • 1.61 kB
JavaScript
import { __extends } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { Vec2 } from '../../../mol-math/linear-algebra';
var PointComponent = /** @class */ (function (_super) {
__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 = 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 ([
_jsx("circle", { r: "10", id: "".concat(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" }, "".concat(this.props.id, "circle"))
]);
};
return PointComponent;
}(React.Component));
export { PointComponent };