From 07f5e56508c362725db003736a0f7980cd72107d Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Sat, 23 Feb 2019 16:19:45 -0500 Subject: PDFNode --- src/fields/ImageField.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/fields/ImageField.ts') diff --git a/src/fields/ImageField.ts b/src/fields/ImageField.ts index bc2e7cdf4..b7470b657 100644 --- a/src/fields/ImageField.ts +++ b/src/fields/ImageField.ts @@ -1,5 +1,6 @@ import { BasicField } from "./BasicField"; import { Field } from "./Field"; +import {observable} from "mobx" export class ImageField extends BasicField { constructor(data: URL | undefined = undefined) { @@ -13,5 +14,8 @@ export class ImageField extends BasicField { Copy(): Field { return new ImageField(this.Data); } + + @observable + Page:Number = 1; } \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 0fce0d7db0986f31a4f1013e42609da382c027e1 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Tue, 26 Feb 2019 18:34:21 -0500 Subject: finished converting from ImageBox to PDFNode --- src/Main.tsx | 32 ++++++++++++++++---------------- src/documents/Documents.ts | 10 +++++----- src/fields/ImageField.ts | 4 ---- src/views/nodes/ImageBox.tsx | 3 +-- src/views/nodes/PDFNode.tsx | 3 ++- 5 files changed, 24 insertions(+), 28 deletions(-) (limited to 'src/fields/ImageField.ts') diff --git a/src/Main.tsx b/src/Main.tsx index 03d44e0e5..f29dd192e 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -40,18 +40,18 @@ document.addEventListener("pointerdown", action(function (e: PointerEvent) { //runInAction(() => { - let PDFDoc = Documents.PDFDocument(""); + let PDFDoc = Documents.PDFDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { + x:0, y:0, width: 500, height: 500, title: "PDF" + }); + let doc1 = Documents.TextDocument({ title: "hello" }); let doc2 = doc1.MakeDelegate(); doc2.Set(KS.X, new NumberField(150)); doc2.Set(KS.Y, new NumberField(20)); - let doc3 = Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { - x:0, y: 0, width: 500, height: 500,title: "cat 1" - }); + let doc3 = Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { + x:0, y: 0, width: 500, height: 500,title: "cat 1" + }); - //let PDFDoc = Documents.PDFDocument("https://arxiv.org/pdf/1708.08021.pdf", { - //x: 450, y: 500, title: "PDF!" - //}) // const schemaDocs = Array.from(Array(5).keys()).map(v => Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { // x: 50 + 100 * v, y: 50, width: 100, height: 100, title: "cat" + v // })); @@ -62,18 +62,18 @@ document.addEventListener("pointerdown", action(function (e: PointerEvent) { - const docset = [doc3]; //pdfDoc - let doc4 = Documents.CollectionDocument(docset, { + const docset = [PDFDoc]; //pdfDoc + let doc4 = Documents.CollectionDocument(docset, { x: 0, y: 400, title: "mini collection" - }); + }); // let doc5 = Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { // x: 650, y: 500, width: 600, height: 600, title: "cat 2" // }); - let docset2 = new Array(doc4);//, doc1, doc3); - let doc6 = Documents.CollectionDocument(docset2, { - x: 350, y: 100, width: 600, height: 600, title: "docking collection" - }); + // let docset2 = new Array(doc4);//, doc1, doc3); + // let doc6 = Documents.CollectionDocument(docset2, { + // x: 350, y: 100, width: 600, height: 600, title: "docking collection" + //}); let mainNodes = null;// mainContainer.GetFieldT(KeyStore.Data, ListField); if (!mainNodes) { mainNodes = new ListField(); @@ -81,8 +81,8 @@ document.addEventListener("pointerdown", action(function (e: PointerEvent) { // mainNodes.Data.push(doc6); // mainNodes.Data.push(doc2); mainNodes.Data.push(doc4); - mainNodes.Data.push(doc3); - //mainNodes.Data.push(PDFDoc); + //mainNodes.Data.push(doc3); + mainNodes.Data.push(PDFDoc); // mainNodes.Data.push(doc5); // mainNodes.Data.push(doc1); //mainNodes.Data.push(doc2); diff --git a/src/documents/Documents.ts b/src/documents/Documents.ts index 6dce4e8f0..56ebbf565 100644 --- a/src/documents/Documents.ts +++ b/src/documents/Documents.ts @@ -12,7 +12,7 @@ import { ImageBox } from "../views/nodes/ImageBox"; import { CollectionFreeFormView } from "../views/collections/CollectionFreeFormView"; import { FIELD_ID } from "../fields/Field"; import {PDFField} from "../fields/PDFField"; -import {PDFNode} from "../views/nodes/PDFNode" +import {PDFNode}from "../views/nodes/PDFNode"; interface DocumentOptions { x?: number; @@ -135,14 +135,14 @@ export namespace Documents { let PDFProto = new Document(); PDFProtoId = PDFProto.Id; PDFProto.Set(KeyStore.Title, new TextField("PDF PROTO")); - PDFProto.Set(KeyStore.X, new NumberField(0)); + PDFProto.Set(KeyStore.X, new NumberField(0)); PDFProto.Set(KeyStore.Y, new NumberField(0)); PDFProto.Set(KeyStore.Width, new NumberField(300)); - PDFProto.Set(KeyStore.Height, new NumberField(300)); - PDFProto.Set(KeyStore.Layout, new TextField(PDFNode.LayoutString())); + PDFProto.Set(KeyStore.Height, new NumberField(300)); + PDFProto.Set(KeyStore.Layout, new TextField(PDFNode.LayoutString())); PDFProto.Set(KeyStore.LayoutKeys, new ListField([KeyStore.Data])); Server.AddDocument(PDFProto); - return PDFProto; + return PDFProto; } return Server.GetDocument(PDFProtoId, true)!; } diff --git a/src/fields/ImageField.ts b/src/fields/ImageField.ts index b7470b657..e6b29fd3f 100644 --- a/src/fields/ImageField.ts +++ b/src/fields/ImageField.ts @@ -14,8 +14,4 @@ export class ImageField extends BasicField { Copy(): Field { return new ImageField(this.Data); } - - @observable - Page:Number = 1; - } \ No newline at end of file diff --git a/src/views/nodes/ImageBox.tsx b/src/views/nodes/ImageBox.tsx index f53d94a6d..c145280a1 100644 --- a/src/views/nodes/ImageBox.tsx +++ b/src/views/nodes/ImageBox.tsx @@ -54,9 +54,8 @@ import { Annotation } from './Annotation'; */ @observer export class ImageBox extends React.Component { - public static LayoutString() { return FieldView.LayoutString("ImageBox"); } - + private _mainDiv = React.createRef() private _pdf = React.createRef(); diff --git a/src/views/nodes/PDFNode.tsx b/src/views/nodes/PDFNode.tsx index e626dc748..814a59500 100644 --- a/src/views/nodes/PDFNode.tsx +++ b/src/views/nodes/PDFNode.tsx @@ -54,7 +54,8 @@ import { Annotation } from './Annotation'; */ @observer export class PDFNode extends React.Component { - + public static LayoutString() { return FieldView.LayoutString("ImageBox"); } + private _mainDiv = React.createRef() private _pdf = React.createRef(); -- cgit v1.2.3-70-g09d2