-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a45ef8
commit 9d1424d
Showing
7 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Attribs, IHiccupShape, Type } from "@thi.ng/geom-api"; | ||
import { set, Vec } from "@thi.ng/vectors"; | ||
import { copyAttribs } from "../internal/copy-attribs"; | ||
|
||
/** | ||
* Basic stub for text elements. Currently, only a minimal set of geometry | ||
* operations are implemented for this type, however this type implements | ||
* {@link @this.ng/api#IToHiccup} and so is useful as wrapper for inclusion of | ||
* text elements in {@link Group}s with other shape types. | ||
*/ | ||
export class Text implements IHiccupShape { | ||
constructor(public pos: Vec, public body: any, public attribs?: Attribs) {} | ||
|
||
get type() { | ||
return Type.TEXT; | ||
} | ||
|
||
copy(): Text { | ||
return new Text(set([], this.pos), this.body, copyAttribs(this)); | ||
} | ||
|
||
toHiccup() { | ||
return ["text", this.attribs, this.pos, this.body]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { Attribs } from "@thi.ng/geom-api"; | ||
import { Vec } from "@thi.ng/vectors"; | ||
import { Text } from "../api/text"; | ||
|
||
export const text = (pos: Vec, body: any, attribs?: Attribs) => | ||
new Text(pos, body, attribs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters