未验证 提交 11be1431 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #16064 from Mugen87/dev23

GridHelper: Fix clone()
......@@ -11,6 +11,13 @@ import { Color } from '../math/Color.js';
function GridHelper( size, divisions, color1, color2 ) {
this.parameters = {
size: size,
divisions: divisions,
color1: color1,
color2: color2
};
size = size || 10;
divisions = divisions || 10;
color1 = new Color( color1 !== undefined ? color1 : 0x444444 );
......@@ -46,7 +53,28 @@ function GridHelper( size, divisions, color1, color2 ) {
}
GridHelper.prototype = Object.create( LineSegments.prototype );
GridHelper.prototype.constructor = GridHelper;
GridHelper.prototype = Object.assign( Object.create( LineSegments.prototype ), {
constructor: GridHelper,
copy( source ) {
LineSegments.prototype.copy.call( this, source );
Object.assign( this.parameters, source.parameters );
return this;
},
clone() {
var paramters = this.parameters;
return new this.constructor( paramters.size, paramters.divisions, paramters.color1, paramters.color2 );
}
} );
export { GridHelper };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册