aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/newlightbox/ButtonMenu/ButtonMenu.tsx
blob: 3eb99f47a82a3f89a94c4eb8f07dfc014527bbb5 (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
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
import { action } from 'mobx';
import * as React from 'react';
import { Doc } from '../../../../fields/Doc';
import { InkTool } from '../../../../fields/InkField';
import { SnappingManager } from '../../../util/SnappingManager';
import { CollectionDockingView } from '../../collections/CollectionDockingView';
import { DocumentView } from '../../nodes/DocumentView';
import { OpenWhereMod } from '../../nodes/OpenWhere';
import { NewLightboxView } from '../NewLightboxView';
import './ButtonMenu.scss';

export function ButtonMenu() {
    return (
        <div className="newLightboxButtonMenu-container">
            <div
                className="newLightboxView-navBtn"
                title="toggle fit width"
                onClick={e => {
                    e.stopPropagation();
                    NewLightboxView.LightboxDoc!._fitWidth = !NewLightboxView.LightboxDoc!._fitWidth;
                }}
            />
            <div
                className="newLightboxView-tabBtn"
                title="open in tab"
                onClick={e => {
                    e.stopPropagation();
                    CollectionDockingView.AddSplit(NewLightboxView.LightboxDoc || NewLightboxView.LightboxDoc!, OpenWhereMod.none);
                    DocumentView.DeselectAll();
                    NewLightboxView.SetNewLightboxDoc(undefined);
                }}
            />
            <div
                className="newLightboxView-penBtn"
                title="toggle pen annotation"
                style={{ background: Doc.ActiveTool === InkTool.Pen ? 'white' : undefined }}
                onClick={e => {
                    e.stopPropagation();
                    Doc.ActiveTool = Doc.ActiveTool === InkTool.Pen ? InkTool.None : InkTool.Pen;
                }}
            />
            <div
                className="newLightboxView-exploreBtn"
                title="toggle explore mode to navigate among documents only"
                style={{ background: SnappingManager.ExploreMode ? 'white' : undefined }}
                onClick={action(e => {
                    e.stopPropagation();
                    SnappingManager.SetExploreMode(!SnappingManager.ExploreMode);
                })}
            />
        </div>
    );
}