diff options
author | bobzel <zzzman@gmail.com> | 2020-09-13 10:22:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-13 10:22:49 -0400 |
commit | e25b4985c8716e39cb586e5ce313a093048ceab6 (patch) | |
tree | 957b5e1d274624721437c9ad96549a81e24888b6 /src | |
parent | bf8a62fbb1b70bc013ec2f342930f35d6108065b (diff) | |
parent | 1508c81e2193f54da586f30da6f547bb1b89f976 (diff) |
Merge pull request #715 from browngraphicslab/bug_fixes
Bug fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/Documents.ts | 2 | ||||
-rw-r--r-- | src/client/views/collections/CollectionPileView.tsx | 27 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index c4100c6d0..8fe55b9a6 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -763,7 +763,7 @@ export namespace Docs { } export function PileDocument(documents: Array<Doc>, options: DocumentOptions, id?: string) { - return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { _chromeStatus: "collapsed", backgroundColor: "black", forceActive: true, ...options, _viewType: CollectionViewType.Pile }, id); + return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { _chromeStatus: "collapsed", backgroundColor: "black", forceActive: true, _noAutoscroll: true, ...options, _viewType: CollectionViewType.Pile }, id); } export function LinearDocument(documents: Array<Doc>, options: DocumentOptions, id?: string) { diff --git a/src/client/views/collections/CollectionPileView.tsx b/src/client/views/collections/CollectionPileView.tsx index 522f93b88..8714751a6 100644 --- a/src/client/views/collections/CollectionPileView.tsx +++ b/src/client/views/collections/CollectionPileView.tsx @@ -1,27 +1,22 @@ -import { action, computed, observable, runInAction } from "mobx"; +import { action, computed, observable } from "mobx"; import { observer } from "mobx-react"; import { HeightSym, Opt, WidthSym, Doc } from "../../../fields/Doc"; import { ScriptField } from "../../../fields/ScriptField"; -import { BoolCast, NumCast, StrCast } from "../../../fields/Types"; +import { NumCast, StrCast } from "../../../fields/Types"; import { CollectionFreeFormView } from "./collectionFreeForm/CollectionFreeFormView"; import { CollectionSubView } from "./CollectionSubView"; import "./CollectionPileView.scss"; import React = require("react"); -import { setupMoveUpEvents, emptyFunction, returnFalse } from "../../../Utils"; +import { setupMoveUpEvents, emptyFunction } from "../../../Utils"; import { SelectionManager } from "../../util/SelectionManager"; import { UndoManager, undoBatch } from "../../util/UndoManager"; import { SnappingManager } from "../../util/SnappingManager"; -import { DragManager } from "../../util/DragManager"; import { DocUtils } from "../../documents/Documents"; @observer export class CollectionPileView extends CollectionSubView(doc => doc) { - _lastTap = 0; - _doubleTap: boolean | undefined = false; _originalChrome: string = ""; - @observable _contentsActive = true; - @observable _collapsed: boolean = false; - @observable _childClickedScript: Opt<ScriptField>; + componentDidMount() { if (this.layoutEngine() !== "pass" && this.layoutEngine() !== "starburst") { this.Document._pileLayoutEngine = "pass"; @@ -35,8 +30,10 @@ export class CollectionPileView extends CollectionSubView(doc => doc) { layoutEngine = () => StrCast(this.Document._pileLayoutEngine); + // returns the contents of the pileup in a CollectionFreeFormView @computed get contents() { - return <div className="collectionPileView-innards" style={{ pointerEvents: this.layoutEngine() === "starburst" ? undefined : "none" }} > + const draggingSelf = this.props.isSelected(); + return <div className="collectionPileView-innards" style={{ pointerEvents: this.layoutEngine() === "starburst" || (SnappingManager.GetIsDragging() && !draggingSelf) ? undefined : "none", zIndex: this.layoutEngine() === "starburst" && !SnappingManager.GetIsDragging() ? -10 : "auto" }} > <CollectionFreeFormView {...this.props} layoutEngine={this.layoutEngine} addDocument={(doc: Doc | Doc[]) => { (doc instanceof Doc ? [doc] : doc).map((d) => DocUtils.iconify(d)); @@ -48,6 +45,8 @@ export class CollectionPileView extends CollectionSubView(doc => doc) { }} /> </div>; } + + // toggles the pileup between starburst to compact toggleStarburst = action(() => { if (this.layoutEngine() === 'starburst') { const defaultSize = 110; @@ -78,11 +77,11 @@ export class CollectionPileView extends CollectionSubView(doc => doc) { } }); + // for dragging documents out of the pileup view _undoBatch: UndoManager.Batch | undefined; pointerDown = (e: React.PointerEvent) => { let dist = 0; SnappingManager.SetIsDragging(true); - // this._lastTap should be set to 0, and this._doubleTap should be set to false in the class header setupMoveUpEvents(this, e, (e: PointerEvent, down: number[], delta: number[]) => { if (this.layoutEngine() === "pass" && this.childDocs.length && e.shiftKey) { dist += Math.sqrt(delta[0] * delta[0] + delta[1] * delta[1]); @@ -108,8 +107,9 @@ export class CollectionPileView extends CollectionSubView(doc => doc) { }, emptyFunction, e.shiftKey && this.layoutEngine() === "pass", this.layoutEngine() === "pass" && e.shiftKey); // this sets _doubleTap } + // onClick for toggling the pileup view onClick = (e: React.MouseEvent) => { - if (e.button === 0) {//} && this._doubleTap) { + if (e.button === 0) { SelectionManager.DeselectAll(); this.toggleStarburst(); e.stopPropagation(); @@ -117,8 +117,7 @@ export class CollectionPileView extends CollectionSubView(doc => doc) { } render() { - - return <div className={"collectionPileView"} onClick={this.onClick} onPointerDown={this.pointerDown} + return <div className={`collectionPileView`} onClick={this.onClick} onPointerDown={this.pointerDown} style={{ width: this.props.PanelWidth(), height: `calc(100% - ${this.props.Document._chromeStatus === "enabled" ? 51 : 0}px)` }}> {this.contents} </div>; |