diff options
| author | Fawn <fangrui_tong@brown.edu> | 2019-03-06 18:58:00 -0500 |
|---|---|---|
| committer | Fawn <fangrui_tong@brown.edu> | 2019-03-06 18:58:00 -0500 |
| commit | c6781458648c4265f2f995be526529be54312f54 (patch) | |
| tree | 7cbdb01df793a6709a614c89268b887181c6b677 /src/client/views/collections/CollectionFreeFormView.tsx | |
| parent | 3e7e715a235db4da57ba22b5cce1ee3c873f5a40 (diff) | |
all inking code
Diffstat (limited to 'src/client/views/collections/CollectionFreeFormView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionFreeFormView.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index 1a7349201..dfc9d41e6 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -21,6 +21,9 @@ import "./CollectionFreeFormView.scss"; import { COLLECTION_BORDER_WIDTH } from "./CollectionView"; import { CollectionViewBase } from "./CollectionViewBase"; import { Documents } from "../../documents/Documents"; +import { InkingCanvas } from "../InkingCanvas"; +import { InkingControl } from "../InkingControl"; +import { InkTool } from "../../../fields/InkField"; import React = require("react"); const JsxParser = require('react-jsx-parser').default;//TODO Why does this need to be imported like this? @@ -66,6 +69,10 @@ export class CollectionFreeFormView extends CollectionViewBase { @action onPointerDown = (e: React.PointerEvent): void => { + // if ink is selected, don't pan + let isInking = !(InkingControl.getInstance().selectedTool === InkTool.None); + if (isInking) return; + if ((e.button === 2 && this.props.active()) || !e.defaultPrevented) { document.removeEventListener("pointermove", this.onPointerMove); @@ -137,7 +144,7 @@ export class CollectionFreeFormView extends CollectionViewBase { let localTransform = this.getLocalTransform() localTransform = localTransform.inverse().scaleAbout(deltaScale, x, y) - console.log(localTransform) + // console.log(localTransform) this.props.Document.SetNumber(KeyStore.Scale, localTransform.Scale); this.SetPan(-localTransform.TranslateX / localTransform.Scale, -localTransform.TranslateY / localTransform.Scale); @@ -305,6 +312,7 @@ export class CollectionFreeFormView extends CollectionViewBase { style={{ transformOrigin: "left top", transform: `translate(${dx}px, ${dy}px) scale(${this.zoomScaling}, ${this.zoomScaling}) translate(${panx}px, ${pany}px)` }} ref={this._canvasRef}> {this.backgroundView} + <InkingCanvas getScreenTransform={this.getTransform} Document={this.props.Document} /> {cursor} {this.views} </div> |
