diff options
author | bobzel <zzzman@gmail.com> | 2019-02-05 23:19:26 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2019-02-05 23:19:26 -0500 |
commit | e59dbb02175ec394a35c496201da71c90cd6a50a (patch) | |
tree | cf56fe399dca0fb64fece2ee1ed22044d95ea25c /src/stores/NodeCollectionStore.ts | |
parent | 4ac7a62d813738b0047caefbcf40d3063ec9e6c1 (diff) |
mostly working version, but confused about LayoutKeys needing to inquire value seemingly unecessarily
Diffstat (limited to 'src/stores/NodeCollectionStore.ts')
-rw-r--r-- | src/stores/NodeCollectionStore.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/stores/NodeCollectionStore.ts b/src/stores/NodeCollectionStore.ts new file mode 100644 index 000000000..7fac83d51 --- /dev/null +++ b/src/stores/NodeCollectionStore.ts @@ -0,0 +1,26 @@ +import { computed, observable, action } from "mobx"; +import { NodeStore } from "./NodeStore"; +import { Document } from "../fields/Document"; + +export class NodeCollectionStore extends NodeStore { + + @observable + public Scale: number = 1; + + @observable + public Nodes: NodeStore[] = new Array<NodeStore>(); + + @observable + public Docs: Document[] = []; + + @computed + public get Transform(): string { + const halfWidth = window.innerWidth / 2, halfHeight = window.innerHeight / 2; + return `translate(${this.X + halfWidth}px, ${this.Y + halfHeight}px) scale(${this.Scale}) translate(${-halfWidth}px, ${-halfHeight}px)`; + } + + @action + public AddNodes(stores: NodeStore[]): void { + stores.forEach(store => this.Nodes.push(store)); + } +}
\ No newline at end of file |