aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FocusViewOptions.ts
blob: 1c462e98f0d9c8cb4d60ab5c0bd945e41fc2a5b7 (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
import { Doc } from '../../../fields/Doc';
import { Transform } from '../../util/Transform';
import { OpenWhere } from './OpenWhere';

export interface FocusViewOptions {
    willPan?: boolean; // determines whether to pan to target document
    willZoomCentered?: boolean; // determines whether to zoom in on target document.  if zoomScale is 0, this just centers the document
    zoomScale?: number; // percent of containing frame to zoom into document
    zoomTime?: number;
    didMove?: boolean; // whether a document was changed during the showDocument process
    docTransform?: Transform; // when a document can't be panned and zoomed within its own container (say a group), then we need to continue to move up the render hierarchy to find something that can pan and zoom.  when this happens the docTransform must accumulate all the transforms of each level of the hierarchy
    instant?: boolean; // whether focus should happen instantly (as opposed to smooth zoom)
    preview?: boolean; // whether changes should be previewed by the componentView or written to the document
    effect?: Doc; // animation effect for focus // bcz: needs to be changed to something more generic than a Doc
    noSelect?: boolean; // whether target should be selected after focusing
    playAudio?: boolean; // whether to play audio annotation on focus
    playMedia?: boolean; // whether to play start target videos
    openLocation?: OpenWhere; // where to open a missing document
    zoomTextSelections?: boolean; // whether to display a zoomed overlay of anchor text selections
    toggleTarget?: boolean; // whether to toggle target on and off
    easeFunc?: 'linear' | 'ease'; // transition method for scrolling
    pointFocus?: { X: number; Y: number }; // clientX and clientY coordinates to focus on instead of a document target (used by explore mode)
    contextPath?: Doc[]; // path of inner documents that will also be focused
}

/**
 * if there's an options.effect, it will be handled from linkFollowHighlight.  We delay the start of
 * the highlight so that the target document can be somewhat centered so that the effect/highlight will be seen
 *  bcz: should this delay be an options parameter?
 * @param options
 * @returns
 */
export function FocusEffectDelay(options: FocusViewOptions) {
    return (options.zoomTime ?? 0) * 0.5;
}