uglymol
Version:
Macromolecular Viewer for Crystallographers
43 lines (32 loc) • 697 B
JavaScript
// @flow
// a small subset of THREE.js v83 that is used by UglyMol
// modified with eslint --fix and manually,
// LICENSE: threejs.org/license (MIT)
export class Vector2 {
/*::
x: number
y: number
isVector2: boolean
*/
constructor(x/*:?number*/, y/*:?number*/) {
this.x = x || 0;
this.y = y || 0;
}
set( x/*:number*/, y/*:number*/ ) {
this.x = x;
this.y = y;
return this;
}
clone() {
return new Vector2( this.x, this.y );
}
copy( v/*:Vector2*/ ) {
this.x = v.x;
this.y = v.y;
return this;
}
equals( v/*:Vector2*/ ) {
return ( ( v.x === this.x ) && ( v.y === this.y ) );
}
}
Vector2.prototype.isVector2 = true;