import React from 'react'; import cx from 'classnames'; import ls from './ConstraintExplorer.less'; import connect from 'ui/connect'; import mapContext from 'ui/mapContext'; import Fa from 'ui/components/Fa'; @connect(streams => streams.sketcherApp.constraintsUpdate) @mapContext(ctx => ({ remove: constr => { let viewer = ctx.services.sketcher.inPlaceEditor.viewer; viewer.parametricManager.remove(constr); viewer.refresh(); }, highlight: constr => { let viewer = ctx.services.sketcher.inPlaceEditor.viewer; viewer.select(constr.getObjects(), true); viewer.refresh(); }, withdraw: constr => { let viewer = ctx.services.sketcher.inPlaceEditor.viewer; viewer.deselectAll(); viewer.refresh(); }, constraints: ctx.services.sketcher.inPlaceEditor.viewer.parametricManager.system.constraints, updateConstraintConstants: c => ctx.services.sketcher.inPlaceEditor.viewer.parametricManager.updateConstraintConstants(c) })) export class ConstraintExplorer extends React.Component { render() { const {constraints} = this.props; return
Constraints
{constraints.map((c, i) =>
this.props.updateConstraintConstants(c)} onMouseEnter={() => this.props.highlight(c)} onMouseLeave={() => this.props.withdraw(c)}> {i}. {c.UI_NAME} this.props.remove(c)}>
)}
; } }