1
0
Fork 0

🚧 Removed point proxy, plugins can decorate points

This commit is contained in:
joostdecock 2018-07-18 14:52:12 +00:00
parent 20e4ada666
commit 2e70a5bd8a

View file

@ -3,23 +3,10 @@ import { Path } from './path'
import { Snippet } from './snippet' import { Snippet } from './snippet'
import { Attributes } from './attributes' import { Attributes } from './attributes'
function PointProxy(id: string) {
this.id = id;
this.get = function(points: any, key: string, proxy: ProxyHandler<Map<any, any>>): Point {
return points.get(key);
};
this.set = function(points: Map<string, Point>, key: string, point: Point, proxy: ProxyHandler<Map<any, any>>) {
point.attributes.add('data-key', key);
point.attributes.add('data-part', this.id);
points.set(key, point);
return true;
};
};
export class Part { export class Part {
id: string; id: string;
render: boolean; render: boolean;
points: any; points: { [index: string]: Point; } = {};
paths: { [index: string]: Path; } = {}; paths: { [index: string]: Path; } = {};
snippets: { [index: string]: Snippet; } = {}; snippets: { [index: string]: Snippet; } = {};
attributes = new Attributes(); attributes = new Attributes();
@ -28,7 +15,6 @@ export class Part {
constructor(id: string) { constructor(id: string) {
this.id = id; this.id = id;
this.render = (id.substr(0,1) === '_') ? false : true; this.render = (id.substr(0,1) === '_') ? false : true;
this.points = new Proxy(new Map(), new PointProxy(id));
this.points.origin = new Point(0,0); this.points.origin = new Point(0,0);
return this; return this;