缓存旋转结果

pull/579/MERGE
ChenX 5 years ago
parent 1af7758b87
commit d9623e1c6e

@ -73,11 +73,15 @@ export class Path implements ISerialize
return this; return this;
} }
private _RotateCache = new Map<number, Path>();
Rotate(rotation: number): Path Rotate(rotation: number): Path
{ {
if (rotation === 0) return this; if (rotation === 0) return this;
if (this._RotateCache.has(rotation))
return this._RotateCache.get(rotation);
let path = new Path(); let path = new Path();
path.Init(this._OrigionPoints, rotation); path.Init(this._OrigionPoints, rotation);
this._RotateCache.set(rotation, path);
return path; return path;
} }

Loading…
Cancel
Save