瀏覽代碼

Merge pull request #21050 from linbingquan/dev-es6-font

Font: Covert to es6.
Mr.doob 4 年之前
父節點
當前提交
6203ac1ea7
共有 1 個文件被更改,包括 8 次插入8 次删除
  1. 8 8
      src/extras/core/Font.js

+ 8 - 8
src/extras/core/Font.js

@@ -1,18 +1,18 @@
 import { ShapePath } from './ShapePath.js';
 
-function Font( data ) {
+class Font {
 
-	this.type = 'Font';
+	constructor( data ) {
 
-	this.data = data;
+		Object.defineProperty( this, 'isFont', { value: true } );
 
-}
+		this.type = 'Font';
 
-Object.assign( Font.prototype, {
+		this.data = data;
 
-	isFont: true,
+	}
 
-	generateShapes: function ( text, size = 100 ) {
+	generateShapes( text, size = 100 ) {
 
 		const shapes = [];
 		const paths = createPaths( text, size, this.data );
@@ -27,7 +27,7 @@ Object.assign( Font.prototype, {
 
 	}
 
-} );
+}
 
 function createPaths( text, size, data ) {