Skip to content

Commit d77ce41

Browse files
authored
fix: remove text and troika deps (#75)
1 parent 26672a9 commit d77ce41

File tree

7 files changed

+3
-328
lines changed

7 files changed

+3
-328
lines changed
-417 KB
Binary file not shown.

.storybook/stories/Text.stories.ts

Lines changed: 0 additions & 119 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -654,84 +654,11 @@ export type BillboardType = {
654654
}
655655
```
656656
657-
#### Text
658-
659-
[![storybook](https://img.shields.io/badge/-storybook-%23ff69b4)](https://pmndrs.github.io/drei-vanilla/?path=/story/abstractions-text--text-story)
657+
#### Text [EXTERNAL]
660658
661659
[drei counterpart](https://github.com/pmndrs/drei#text)
662660
663-
Hi-quality text rendering w/ signed distance fields (SDF) and antialiasing, using [troika-3d-text](https://github.com/protectwise/troika/tree/master/packages/troika-3d-text). All of troikas props are valid!
664-
665-
> Required `troika-three-text` >= `0.46.4`
666-
667-
```ts
668-
export type TextProps = {
669-
characters?: string
670-
color?: number | string
671-
// the text content
672-
text: string
673-
/** Font size, default: 1 */
674-
fontSize?: number
675-
maxWidth?: number
676-
lineHeight?: number
677-
letterSpacing?: number
678-
textAlign?: 'left' | 'right' | 'center' | 'justify'
679-
font?: string
680-
anchorX?: number | 'left' | 'center' | 'right'
681-
anchorY?: number | 'top' | 'top-baseline' | 'middle' | 'bottom-baseline' | 'bottom'
682-
clipRect?: [number, number, number, number]
683-
depthOffset?: number
684-
direction?: 'auto' | 'ltr' | 'rtl'
685-
overflowWrap?: 'normal' | 'break-word'
686-
whiteSpace?: 'normal' | 'overflowWrap' | 'nowrap'
687-
outlineWidth?: number | string
688-
outlineOffsetX?: number | string
689-
outlineOffsetY?: number | string
690-
outlineBlur?: number | string
691-
outlineColor?: number | string
692-
outlineOpacity?: number
693-
strokeWidth?: number | string
694-
strokeColor?: number | string
695-
strokeOpacity?: number
696-
fillOpacity?: number
697-
sdfGlyphSize?: number
698-
debugSDF?: boolean
699-
onSync?: (troika: any) => void
700-
onPreloadEnd?: () => void
701-
}
702-
```
703-
704-
Usage
705-
706-
```jsx
707-
const text = Text({
708-
text: 'Hello World',
709-
})
710-
const mesh = new THREE.Mesh(geometry, material)
711-
mesh.add(text.mesh)
712-
```
713-
714-
Text function returns the following
715-
716-
```jsx
717-
export type TextType = {
718-
mesh: THREE.Mesh
719-
updateProps: (newProps: Partial<TextProps>) => void
720-
dispose: () => void
721-
}
722-
```
723-
724-
You can preload the font and characters:
725-
726-
```ts
727-
const preloadRelatedParams = {
728-
// support ttf/otf/woff(woff2 is not supported)
729-
font: '/your/font/path',
730-
characters: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!?.,:;\'"()[]{}<>|/@\\^$-%+=#_&~*',
731-
onPreloadEnd: () => {
732-
// this is the callback when font and characters are loaded
733-
},
734-
```
661+
Hi-quality text rendering w/ signed distance fields (SDF) and antialiasing, using [troika-3d-text](https://github.com/protectwise/troika/tree/master/packages/troika-3d-text).
735662
736663
#### Splat
737664

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
"build-storybook": "build-storybook"
6060
},
6161
"dependencies": {
62-
"glsl-noise": "^0.0.0",
63-
"troika-three-text": "0.47.2"
62+
"glsl-noise": "^0.0.0"
6463
},
6564
"devDependencies": {
6665
"@babel/core": "^7.14.3",

src/core/Text.ts

Lines changed: 0 additions & 99 deletions
This file was deleted.

src/core/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export * from './SpriteAnimator'
1414
// Abstractions
1515
export * from './Outlines'
1616
export * from './Billboard'
17-
export * from './Text'
1817
export * from './Splat'
1918

2019
// Gizmos

yarn.lock

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4567,13 +4567,6 @@ better-opn@^2.1.1:
45674567
dependencies:
45684568
open "^7.0.3"
45694569

4570-
bidi-js@^1.0.2:
4571-
version "1.0.3"
4572-
resolved "https://registry.yarnpkg.com/bidi-js/-/bidi-js-1.0.3.tgz#6f8bcf3c877c4d9220ddf49b9bb6930c88f877d2"
4573-
integrity sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==
4574-
dependencies:
4575-
require-from-string "^2.0.2"
4576-
45774570
big-integer@^1.6.7:
45784571
version "1.6.51"
45794572
resolved "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz"
@@ -14005,26 +13998,6 @@ [email protected]:
1400513998
resolved "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz"
1400613999
integrity sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==
1400714000

14008-
14009-
version "0.47.2"
14010-
resolved "https://registry.yarnpkg.com/troika-three-text/-/troika-three-text-0.47.2.tgz#fdf89059c010563bb829262b20c41f69ca79b712"
14011-
integrity sha512-qylT0F+U7xGs+/PEf3ujBdJMYWbn0Qci0kLqI5BJG2kW1wdg4T1XSxneypnF05DxFqJhEzuaOR9S2SjiyknMng==
14012-
dependencies:
14013-
bidi-js "^1.0.2"
14014-
troika-three-utils "^0.47.2"
14015-
troika-worker-utils "^0.47.2"
14016-
webgl-sdf-generator "1.1.1"
14017-
14018-
troika-three-utils@^0.47.2:
14019-
version "0.47.2"
14020-
resolved "https://registry.yarnpkg.com/troika-three-utils/-/troika-three-utils-0.47.2.tgz#af49ca694245dce631963d5fefe4e8e1b8af9044"
14021-
integrity sha512-/28plhCxfKtH7MSxEGx8e3b/OXU5A0xlwl+Sbdp0H8FXUHKZDoksduEKmjQayXYtxAyuUiCRunYIv/8Vi7aiyg==
14022-
14023-
troika-worker-utils@^0.47.2:
14024-
version "0.47.2"
14025-
resolved "https://registry.yarnpkg.com/troika-worker-utils/-/troika-worker-utils-0.47.2.tgz#e7c5de5f37d56c072b13fa8112bb844e048ff46c"
14026-
integrity sha512-mzss4MeyzUkYBppn4x5cdAqrhBHFEuVmMMgLMTyFV23x6GvQMyo+/R5E5Lsbrt7WSt5RfvewjcwD1DChRTA9lA==
14027-
1402814001
trough@^1.0.0:
1402914002
version "1.0.5"
1403014003
resolved "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz"
@@ -14631,11 +14604,6 @@ web-namespaces@^1.0.0:
1463114604
resolved "https://registry.npmjs.org/web-namespaces/-/web-namespaces-1.1.4.tgz"
1463214605
integrity sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw==
1463314606

14634-
14635-
version "1.1.1"
14636-
resolved "https://registry.yarnpkg.com/webgl-sdf-generator/-/webgl-sdf-generator-1.1.1.tgz#3e1b422b3d87cd3cc77f2602c9db63bc0f6accbd"
14637-
integrity sha512-9Z0JcMTFxeE+b2x1LJTdnaT8rT8aEp7MVxkNwoycNmJWwPdzoXzMh0BjJSh/AEFP+KPYZUli814h8bJZFIZ2jA==
14638-
1463914607
webidl-conversions@^3.0.0:
1464014608
version "3.0.1"
1464114609
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"

0 commit comments

Comments
 (0)