feat: text input bubble (#7089)

* feat: add basic text bubble

* feat: add resizing the text input bubble

* chore: add docs

* chore: mouse -> pointer

* chore: fixup from PR comments
This commit is contained in:
Beka Westberg
2023-05-24 13:01:03 -07:00
committed by GitHub
parent 5b2529a25d
commit b5db021eed
2 changed files with 323 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ export abstract class Bubble implements IBubble {
static readonly ANCHOR_RADIUS = 8;
/** The SVG group containing all parts of the bubble. */
private svgRoot: SVGGElement;
protected svgRoot: SVGGElement;
/** The SVG path for the arrow from the anchor to the bubble. */
private tail: SVGPathElement;
@@ -534,6 +534,20 @@ export abstract class Bubble implements IBubble {
steps.push('z');
this.tail?.setAttribute('d', steps.join(' '));
}
/**
* Move this bubble to the front of the visible workspace.
*
* @returns Whether or not the bubble has been moved.
* @internal
*/
bringToFront(): boolean {
const svgGroup = this.svgRoot?.parentNode;
if (this.svgRoot && svgGroup?.lastChild !== this.svgRoot) {
svgGroup?.appendChild(this.svgRoot);
return true;
}
return false;
}
/** @internal */
getRelativeToSurfaceXY(): Coordinate {