("dashOnGesture",
{
bubbles: true,
detail: {
points: this._points,
gesture: GestureUtils.Gestures.Stroke,
bounds: B
}
}
)
)
this._points = [];
}
}
document.removeEventListener("pointermove", this.onPointerMove);
document.removeEventListener("pointerup", this.onPointerUp);
}
@computed get svgBounds() {
const xs = this._points.map(p => p.X);
const ys = this._points.map(p => p.Y);
const right = Math.max(...xs);
const left = Math.min(...xs);
const bottom = Math.max(...ys);
const top = Math.min(...ys);
return { right: right, left: left, bottom: bottom, top: top, width: right - left, height: bottom - top };
}
@computed get currentStroke() {
if (this._points.length <= 1) {
return (null);
}
const B = this.svgBounds;
return (
);
}
@action
enableMobileInkOverlay = (content: MobileInkOverlayContent) => {
this.showMobileInkOverlay = content.enableOverlay;
}
render() {
return (
{this.showMobileInkOverlay ? : <>>}
{this.currentStroke}
{this.props.children}
{this._palette}
);
}
}
Scripting.addGlobal("GestureOverlay", GestureOverlay);
Scripting.addGlobal(function setPen(width: any, color: any) { runInAction(() => { GestureOverlay.Instance.Color = color; GestureOverlay.Instance.Width = width; }); });
Scripting.addGlobal(function resetPen() { runInAction(() => { GestureOverlay.Instance.Color = "rgb(244, 67, 54)"; GestureOverlay.Instance.Width = 5; }); });