在src/lib中,创建PointUtils.ts
import {
IPoint, Point, ObservablePoint} from "pixi.js";
declare module "pixi.js"{
interface IPoint{
length(): number;
add(other: IPoint): Point;
sub(other: IPoint): Point;
}
}
Point.prototype.length = function(){
return Math.sqrt(this.x * this.x + this.y * this.y);
}
Point.prototype.add = function(other: IPoint