Skip to content

Commit 027b25f

Browse files
authored
THREE.TextGeometry: .height -> .depth (#27949)
* THREE.TextGeometry: `.height` -> `.depth` - depreciating `height` parameter in TextGeometry options for `depth` for consistency with ExtrudeGeometry, which refers to the thickness the Text will be extruded. using `height` is still supported but will emit a warning in the console - updated examples, manual and docs * missed one reference
1 parent 70aed3d commit 027b25f

20 files changed

+38
-30
lines changed

docs/examples/en/geometries/TextGeometry.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h2>Code Example</h2>
3838
const geometry = new TextGeometry( 'Hello three.js!', {
3939
font: font,
4040
size: 80,
41-
height: 5,
41+
depth: 5,
4242
curveSegments: 12,
4343
bevelEnabled: true,
4444
bevelThickness: 10,
@@ -64,7 +64,7 @@ <h3>[name]([param:String text], [param:Object parameters])</h3>
6464
<ul>
6565
<li>font — an instance of THREE.Font.</li>
6666
<li>size — Float. Size of the text. Default is 100.</li>
67-
<li>height — Float. Thickness to extrude text. Default is 50.</li>
67+
<li>depth — Float. Thickness to extrude text. Default is 50.</li>
6868
<li>curveSegments — Integer. Number of points on the curves. Default is 12.</li>
6969
<li>bevelEnabled — Boolean. Turn on bevel. Default is False.</li>
7070
<li>bevelThickness — Float. How deep into text bevel goes. Default is 10.</li>

docs/examples/zh/geometries/TextGeometry.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h2>代码示例</h2>
3838
const geometry = new TextGeometry( 'Hello three.js!', {
3939
font: font,
4040
size: 80,
41-
height: 5,
41+
depth: 5,
4242
curveSegments: 12,
4343
bevelEnabled: true,
4444
bevelThickness: 10,
@@ -63,7 +63,7 @@ <h3>[name]([param:String text], [param:Object parameters])</h3>
6363
<ul>
6464
<li>font — THREE.Font的实例。</li>
6565
<li>size — Float。字体大小,默认值为100。</li>
66-
<li>height — Float。挤出文本的厚度。默认值为50。</li>
66+
<li>depth — Float。挤出文本的厚度。默认值为50。</li>
6767
<li>curveSegments — Integer。(表示文本的)曲线上点的数量。默认值为12。</li>
6868
<li>bevelEnabled — Boolean。是否开启斜角,默认为false。</li>
6969
<li>bevelThickness — Float。文本上斜角的深度,默认值为20。</li>

examples/jsm/geometries/TextGeometry.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* font: <THREE.Font>, // font
66
*
77
* size: <float>, // size of the text
8-
* height: <float>, // thickness to extrude text
8+
* depth: <float>, // thickness to extrude text
99
* curveSegments: <int>, // number of points on the curves
1010
*
1111
* bevelEnabled: <bool>, // turn on bevel
@@ -35,7 +35,15 @@ class TextGeometry extends ExtrudeGeometry {
3535

3636
// translate parameters to ExtrudeGeometry API
3737

38-
parameters.depth = parameters.height !== undefined ? parameters.height : 50;
38+
if ( parameters.depth === undefined && parameters.height !== undefined ) {
39+
40+
console.warn( 'THREE.TextGeometry: .height is now depreciated. Please use .depth instead' ); // @deprecated, r163
41+
42+
}
43+
44+
parameters.depth = parameters.depth !== undefined ?
45+
parameters.depth : parameters.height !== undefined ?
46+
parameters.height : 50;
3947

4048
// defaults
4149

examples/webgl_camera_logarithmicdepthbuffer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
const labelgeo = new TextGeometry( labeldata[ i ].label, {
190190
font: font,
191191
size: labeldata[ i ].size,
192-
height: labeldata[ i ].size / 2
192+
depth: labeldata[ i ].size / 2
193193
} );
194194

195195
labelgeo.computeBoundingSphere();

examples/webgl_custom_attributes_lines.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
font: font,
111111

112112
size: 50,
113-
height: 15,
113+
depth: 15,
114114
curveSegments: 10,
115115

116116
bevelThickness: 5,

examples/webgl_geometry_text.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
fontName = 'optimer', // helvetiker, optimer, gentilis, droid sans, droid serif
5151
fontWeight = 'bold'; // normal bold
5252

53-
const height = 20,
53+
const depth = 20,
5454
size = 70,
5555
hover = 30,
5656

@@ -298,7 +298,7 @@
298298
font: font,
299299

300300
size: size,
301-
height: height,
301+
depth: depth,
302302
curveSegments: curveSegments,
303303

304304
bevelThickness: bevelThickness,
@@ -328,7 +328,7 @@
328328

329329
textMesh2.position.x = centerOffset;
330330
textMesh2.position.y = - hover;
331-
textMesh2.position.z = height;
331+
textMesh2.position.z = depth;
332332

333333
textMesh2.rotation.x = Math.PI;
334334
textMesh2.rotation.y = Math.PI * 2;

examples/webgl_loader_ttf.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
let firstLetter = true;
3636

3737
let text = 'three.js';
38-
const height = 20,
38+
const depth = 20,
3939
size = 70,
4040
hover = 30,
4141
curveSegments = 4,
@@ -193,7 +193,7 @@
193193
font: font,
194194

195195
size: size,
196-
height: height,
196+
depth: depth,
197197
curveSegments: curveSegments,
198198

199199
bevelThickness: bevelThickness,
@@ -224,7 +224,7 @@
224224

225225
textMesh2.position.x = centerOffset;
226226
textMesh2.position.y = - hover;
227-
textMesh2.position.z = height;
227+
textMesh2.position.z = depth;
228228

229229
textMesh2.rotation.x = Math.PI;
230230
textMesh2.rotation.y = Math.PI * 2;

examples/webgl_materials_toon.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
font: font,
120120

121121
size: 20,
122-
height: 1,
122+
depth: 1,
123123
curveSegments: 1
124124

125125
} );

examples/webgl_modifier_curve.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
const geometry = new TextGeometry( 'Hello three.js!', {
111111
font: font,
112112
size: 0.2,
113-
height: 0.05,
113+
depth: 0.05,
114114
curveSegments: 12,
115115
bevelEnabled: true,
116116
bevelThickness: 0.02,

examples/webgl_modifier_curve_instanced.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
const geometry = new TextGeometry( 'Hello three.js!', {
124124
font: font,
125125
size: 0.2,
126-
height: 0.05,
126+
depth: 0.05,
127127
curveSegments: 12,
128128
bevelEnabled: true,
129129
bevelThickness: 0.02,

0 commit comments

Comments
 (0)