UNPKG

@rcsb/rcsb-saguaro-3d

Version:
37 lines 1.82 kB
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; /* * Copyright (c) 2021 RCSB PDB and contributors, licensed under MIT, See LICENSE file for more info. * @author Joan Segura Mora <joan.segura@rcsb.org> */ import React from "react"; import * as classes from '../../../../../scss/MsaPfvStyle.module.scss'; import { asyncScheduler } from "rxjs"; export class MsaRowMarkComponent extends React.Component { constructor(props) { super(props); this.HOVER_COLOR = "rgb(51, 122, 183)"; this.ACTIVE_COLOR = "rgb(51, 122, 183)"; this.state = { visibility: undefined, borderLeftColor: undefined, markHoverColor: this.HOVER_COLOR }; } render() { return (_jsx(_Fragment, { children: _jsx("div", { onClick: this.click.bind(this), onMouseOver: this.hover.bind(this), style: { visibility: this.state.visibility, cursor: "pointer", display: "inline-block", width: 6, height: 6, marginBottom: 4, marginRight: 5 }, children: _jsx("div", { className: classes.msaRowMark, onMouseOut: () => this.markHover(false), onMouseOver: () => this.markHover(true), style: { borderLeftColor: this.props.isGlowing ? this.state.markHoverColor : (this.state.borderLeftColor) } }) }) })); } click() { asyncScheduler.schedule(() => { var _a, _b; return (_b = (_a = this.props).clickCallback) === null || _b === void 0 ? void 0 : _b.call(_a); }); } hover() { var _a, _b; (_b = (_a = this.props).hoverCallback) === null || _b === void 0 ? void 0 : _b.call(_a); } markHover(flag) { if (flag) this.setState({ markHoverColor: this.ACTIVE_COLOR }); else this.setState({ markHoverColor: this.HOVER_COLOR }); } } //# sourceMappingURL=MsaRowMarkComponent.js.map