in bindings/jupyter-modules/jupyter-ma-causal/src/components/slidebar/index.js [108:170]
_renderTip() {
const {
extent: [[x0, y0], [x1, y1]],
} = this.props;
const x = this._getX();
return (
<rect
cursor="ew-resize"
x={x - 5}
y={y0}
width={10}
height={y1}
fill="none"
pointerEvents={this.props.disableDrag ? 'none' : 'visible'}
onPointerDown={event => {
if (this.props.disableDrag) {
return;
}
event.target.setPointerCapture(event.pointerId);
this.move = this.props.getEventMouse(event);
this.props.onDragStart({
target: this,
type: 'start',
x: this.state.x,
sourceEvent: event,
});
}}
onPointerMove={event => {
if (this.props.disableDrag) {
return;
}
if (this.move) {
const [x, y] = this.props.getEventMouse(event);
const [sx] = this.move;
const dx = x - sx;
const mx = Math.min(Math.max(x + dx, x0), x1);
this.move = [x, y];
this.setState({x: mx});
this.props.onDrag({
target: this,
type: 'drag',
x: mx,
sourceEvent: event,
});
}
}}
onPointerUp={event => {
if (this.props.disableDrag) {
return;
}
this.move = null;
this.props.onDragEnd({
target: this,
type: 'end',
x: this.state.x,
sourceEvent: event,
});
}}
/>
);
}