aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/smartdraw/DrawingPalette.tsx
blob: 87a39bc8547b7b933d4375f375502df72e067676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { returnAll, returnFalse, returnOne, returnZero } from '../../../ClientUtils';
import { Doc, StrListCast } from '../../../fields/Doc';
import { emptyFunction } from '../../../Utils';
import { CollectionViewType } from '../../documents/DocumentTypes';
import { MarqueeView } from '../collections/collectionFreeForm';
import { CollectionGridView } from '../collections/collectionGrid';
import { CollectionStackingView } from '../collections/CollectionStackingView';
import { DocumentView } from '../nodes/DocumentView';
import { FieldViewProps } from '../nodes/FieldView';
import { ObservableReactComponent } from '../ObservableReactComponent';
import './DrawingPalette.scss';

@observer
export class DrawingPalette extends ObservableReactComponent<{}> {
    @observable private _savedDrawings: Doc[] = [];
    @observable _marqueeViewRef = React.createRef<MarqueeView>();
    private _stackRef = React.createRef<CollectionStackingView>();

    constructor(props: any) {
        super(props);
        makeObservable(this);
    }

    panelWidth = () => 100;
    panelHeight = () => 100;

    getCollection = () => {
        return this._marqueeViewRef.current?.collection(undefined, false, this._savedDrawings) || new Doc();
    };

    @computed get savedDrawingAnnos() {
        // const savedAnnos = Doc.MyDrawingAnnos;
        return (
            <div className="collectionMenu-contMenuButtons" style={{ height: '100%' }}>
                {/* <DocumentView PanelHeight={this.panelWidth} PanelWidth={this.panelHeight} Document={savedAnnos} renderDepth={2} isContentActive={returnFalse} childFilters={this.childFilters} /> */}
                {/* <CollectionStackingView
                    {...this._props}
                    Document={savedAnnos}
                    // setContentViewBox={emptyFunction}
                    // NativeWidth={returnZero}
                    // NativeHeight={returnZero}
                    ref={this._stackRef}
                    PanelHeight={this.panelWidth}
                    PanelWidth={this.panelHeight}
                    // childFilters={this.childFilters}
                    // sortFunc={this.sortByLinkAnchorY}
                    // setHeight={this.setHeightCallback}
                    // isAnnotationOverlay={false}
                    // select={emptyFunction}
                    NativeDimScaling={returnOne}
                    // childlayout_showTitle={this.layout_showTitle}
                    isContentActive={returnFalse}
                    isSelected={returnFalse}
                    isAnyChildContentActive={returnFalse}
                    // childDocumentsActive={this._props.isContentActive}
                    whenChildContentsActiveChanged={this._props.whenChildContentsActiveChanged}
                    childHideDecorationTitle
                    // ScreenToLocalTransform={this.screenToLocalTransform}
                    renderDepth={this._props.renderDepth + 1}
                    type_collection={CollectionViewType.Stacking}
                    // fieldKey={'drawing-palette'}
                    pointerEvents={returnAll}
                /> */}
            </div>
        );
    }

    render() {
        return (
            <div className="drawing-palette">
                {/* {this._savedDrawings.map(doc => {
                    return <DocumentView 
                    Document={doc} 
                    renderDepth={0} 
                    PanelWidth={this.panelWidth} 
                    PanelHeight={this.panelHeight} 
                    isContentActive={this.isContentActive} />;
                })} */}
                {/* <CollectionGridView {...this._props} /> */}
                {}
                {/* <DocumentView Document={this.getCollection()} /> */}
                {this.savedDrawingAnnos}
            </div>
        );
    }
}