aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionCardDeckView.tsx26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx
index 5f8ddd5c1..34800040c 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -1,7 +1,8 @@
import { IReactionDisposer, ObservableMap, action, computed, makeObservable, observable, reaction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
-import { DashColor, Utils, numberRange, returnFalse, returnZero } from '../../../Utils';
+import { ClientUtils, DashColor, returnFalse, returnZero } from '../../../ClientUtils';
+import { numberRange } from '../../../Utils';
import { Doc, NumListCast } from '../../../fields/Doc';
import { DocData } from '../../../fields/DocSymbols';
import { Id } from '../../../fields/FieldSymbols';
@@ -10,11 +11,10 @@ import { URLField } from '../../../fields/URLField';
import { gptImageLabel } from '../../apis/gpt/GPT';
import { DocumentType } from '../../documents/DocumentTypes';
import { DragManager } from '../../util/DragManager';
-import { SelectionManager } from '../../util/SelectionManager';
import { SnappingManager } from '../../util/SnappingManager';
import { Transform } from '../../util/Transform';
import { undoable } from '../../util/UndoManager';
-import { StyleProp } from '../StyleProvider';
+import { StyleProp } from '../StyleProp';
import { DocumentView } from '../nodes/DocumentView';
import { GPTPopup, GPTPopupMode } from '../pdf/GPTPopup/GPTPopup';
import './CollectionCardDeckView.scss';
@@ -139,7 +139,7 @@ export class CollectionCardView extends CollectionSubView() {
@action
setHoveredNodeIndex = (index: number) => {
- if (!SelectionManager.IsSelected(this.childDocs[index])) {
+ if (!DocumentView.SelectedDocs().includes(this.childDocs[index])) {
this._hoveredNodeIndex = index;
}
};
@@ -148,14 +148,14 @@ export class CollectionCardView extends CollectionSubView() {
* @param index
* @returns
*/
- translateHover = (index: number) => (this._hoveredNodeIndex === index && !SelectionManager.IsSelected(this.childDocs[index]) ? -50 : 0);
+ translateHover = (index: number) => (this._hoveredNodeIndex === index && !DocumentView.SelectedDocs().includes(this.childDocs[index]) ? -50 : 0);
- isSelected = (index: number) => SelectionManager.IsSelected(this.childDocs[index]);
+ isSelected = (index: number) => DocumentView.SelectedDocs().includes(this.childDocs[index]);
/**
* Returns all the documents except the one that's currently selected
*/
- inactiveDocs = () => this.childDocsWithoutLinks.filter(d => !SelectionManager.IsSelected(d));
+ inactiveDocs = () => this.childDocsWithoutLinks.filter(d => !DocumentView.SelectedDocs().includes(d));
panelWidth = () => this._childDocumentWidth;
panelHeight = (layout: Doc) => () => (this.panelWidth() * NumCast(layout._height)) / NumCast(layout._width);
@@ -267,7 +267,7 @@ export class CollectionCardView extends CollectionSubView() {
Document={doc}
NativeWidth={returnZero}
NativeHeight={returnZero}
- layout_fitWidth={returnFalse}
+ fitWidth={returnFalse}
onDoubleClickScript={this.onChildDoubleClick}
renderDepth={this._props.renderDepth + 1}
LayoutTemplate={this._props.childLayoutTemplate}
@@ -442,18 +442,18 @@ export class CollectionCardView extends CollectionSubView() {
* Actually renders all the cards
*/
renderCards = () => {
- const anySelected = this.childDocs.some(doc => SelectionManager.IsSelected(doc));
+ const anySelected = this.childDocs.some(doc => DocumentView.SelectedDocs().includes(doc));
// Map sorted documents to their rendered components
return this.sortedDocs.map((doc, index) => {
- const realIndex = this.sortedDocs.filter(sortDoc => !SelectionManager.IsSelected(sortDoc)).indexOf(doc);
+ const realIndex = this.sortedDocs.filter(sortDoc => !DocumentView.SelectedDocs().includes(sortDoc)).indexOf(doc);
const calcRowIndex = this.overflowIndexCalc(realIndex);
const amCards = this.overflowAmCardsCalc(realIndex);
- const isSelected = SelectionManager.IsSelected(doc);
+ const isSelected = DocumentView.SelectedDocs().includes(doc);
const childScreenToLocal = () => {
this._forceChildXf;
const dref = this._docRefs.get(doc);
- const { translateX, translateY, scale } = Utils.GetScreenTransform(dref?.ContentDiv);
+ const { translateX, translateY, scale } = ClientUtils.GetScreenTransform(dref?.ContentDiv);
return new Transform(-translateX + (dref?.centeringX || 0) * scale,
-translateY + (dref?.centeringY || 0) * scale, 1)
.scale(1 / scale).rotate(!isSelected ? -this.rotate(amCards, calcRowIndex) : 0); // prettier-ignore
@@ -465,7 +465,7 @@ export class CollectionCardView extends CollectionSubView() {
className={`card-item${isSelected ? '-active' : anySelected ? '-inactive' : ''}`}
onPointerUp={() => {
// this turns off documentDecorations during a transition, then turns them back on afterward.
- SnappingManager.SetIsResizing(this.Document);
+ SnappingManager.SetIsResizing(this.Document[Id]);
setTimeout(
action(() => {
SnappingManager.SetIsResizing(undefined);