aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-09-12 13:29:48 -0700
committerLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-09-12 13:29:48 -0700
commitd5e6a9c5d57b7c3315fb71f25eff8f883cc687ef (patch)
treed1958b5d1dcb8fb2410c17f1976ad45d211e8353 /src
parentdf80eb87e2c50c9ce90de8641108639858fae652 (diff)
cleaning up code
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionPileView.tsx21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/client/views/collections/CollectionPileView.tsx b/src/client/views/collections/CollectionPileView.tsx
index e85aac2e3..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,6 +30,7 @@ export class CollectionPileView extends CollectionSubView(doc => doc) {
layoutEngine = () => StrCast(this.Document._pileLayoutEngine);
+ // returns the contents of the pileup in a CollectionFreeFormView
@computed get contents() {
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" }} >
@@ -49,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;
@@ -79,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]);
@@ -109,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();