Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experiment] Interactions #3092

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b0f727f
brushing session
steveruizok Mar 10, 2024
bc7672a
Update BrushingSession.ts
steveruizok Mar 10, 2024
388bfcc
Update BrushingSession.ts
steveruizok Mar 10, 2024
c2f98e7
ok
steveruizok Mar 10, 2024
dd0e210
add methods
steveruizok Mar 10, 2024
7db8ba8
Update Brushing.ts
steveruizok Mar 10, 2024
9c5c3f7
add some comments
steveruizok Mar 10, 2024
015d840
cropping
steveruizok Mar 10, 2024
a5f8952
translating crop
steveruizok Mar 10, 2024
cbf95b3
Merge branch 'main' into sessions
steveruizok Mar 10, 2024
62c03fa
cleanup
steveruizok Mar 10, 2024
d41c37f
Merge branch 'sessions' of https://github.com/tldraw/tldraw into sess…
steveruizok Mar 10, 2024
d59818f
switch event ordering
steveruizok Mar 11, 2024
6bf3891
fixed event ordering bug
steveruizok Mar 11, 2024
af2d58c
on key up, not down
steveruizok Mar 11, 2024
05f048c
rename cropping states
steveruizok Mar 11, 2024
21d6d8e
fix tests
steveruizok Mar 11, 2024
b0199bd
adding onEnd?
steveruizok Mar 11, 2024
336d1e9
Update TranslatingArrowLabel.ts
steveruizok Mar 11, 2024
c7a9557
erasing session
steveruizok Mar 11, 2024
6ed0c68
fix cursor
steveruizok Mar 11, 2024
8b75eea
translating
steveruizok Mar 11, 2024
39bcb22
resizing
steveruizok Mar 12, 2024
d3fa1d6
lasering
steveruizok Mar 12, 2024
371f69c
ok
steveruizok Mar 13, 2024
b7e53e3
ok
steveruizok Mar 13, 2024
e005925
ok
steveruizok Mar 13, 2024
9f0b9a4
fix errors
steveruizok Mar 13, 2024
06bc526
fix bad rotate test, add another
steveruizok Mar 13, 2024
dcc58fe
remove d&d manager, duplicated state
steveruizok Mar 13, 2024
0a53b3b
start killing dragging handle
steveruizok Mar 13, 2024
979effb
renaming, line tool
steveruizok Mar 15, 2024
9b920b7
dragging handle
steveruizok Mar 15, 2024
d31e8fc
Merge branch 'main' into sessions
steveruizok Mar 15, 2024
e5f19b6
ok
steveruizok Mar 15, 2024
17bb673
add between events?
steveruizok Mar 15, 2024
4f597d8
Update DrawingInteraction.ts
steveruizok Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 91 additions & 14 deletions packages/editor/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,6 @@ export { atom }
// @public (undocumented)
export function average(A: VecLike, B: VecLike): string;

// @public (undocumented)
export abstract class BaseBoxShapeTool extends StateNode {
// (undocumented)
static children: () => (typeof Idle | typeof Pointing)[];
// (undocumented)
static id: string;
// (undocumented)
static initial: string;
// (undocumented)
onCreate?: (_shape: null | TLShape) => null | void;
// (undocumented)
abstract shapeType: string;
}

// @public (undocumented)
export abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> extends ShapeUtil<Shape> {
// (undocumented)
Expand Down Expand Up @@ -1177,6 +1163,97 @@ export function HTMLContainer({ children, className, ...rest }: HTMLContainerPro
// @public (undocumented)
export type HTMLContainerProps = React_3.HTMLAttributes<HTMLDivElement>;

// @public
export abstract class Interaction<T extends object = object> {
constructor(editor: Editor, info?: InteractionInfo<T>);
cancel(): this;
complete(): this;
dispose: () => void;
// (undocumented)
protected duration: number;
// (undocumented)
editor: Editor;
// (undocumented)
protected elapsed: number;
// (undocumented)
protected handleEditorEvent: (event: TLEventInfo) => void;
// (undocumented)
protected handleTick: (elapsed: number) => void;
// (undocumented)
abstract readonly id: string;
// (undocumented)
info: InteractionInfo<T>;
interrupt(): this;
// (undocumented)
isDisposed: boolean;
// (undocumented)
protected onCancel?(): void;
// (undocumented)
protected onComplete?(): void;
// (undocumented)
protected onEnd?(): void;
// (undocumented)
protected onInterrupt?(): void;
// (undocumented)
protected onKeyDown?(): void;
// (undocumented)
protected onKeyUp?(): void;
// (undocumented)
protected onPointerMove?(): void;
// (undocumented)
protected onStart?(): void;
// (undocumented)
protected onUpdate?(): void;
start(): this;
update(): this;
}

// @public
export class InteractionEvent<T extends object = object> {
constructor(info: T, duration: number, elapsed: number);
// (undocumented)
duration: number;
// (undocumented)
elapsed: number;
// (undocumented)
info: T;
// (undocumented)
isDefaultPrevented: boolean;
// (undocumented)
preventDefault(): void;
}

// @public
export interface InteractionEventHandlers<T extends object = object> {
// (undocumented)
onBeforeCancel?: (event: InteractionEvent<T>) => void;
// (undocumented)
onBeforeComplete?: (event: InteractionEvent<T>) => void;
// (undocumented)
onBeforeEnd?: (event: InteractionEvent<T>) => void;
// (undocumented)
onBeforeInterrupt?: (event: InteractionEvent<T>) => void;
// (undocumented)
onBeforeStart?: (event: InteractionEvent<T>) => void;
// (undocumented)
onBeforeUpdate?: (event: InteractionEvent<T>) => void;
// (undocumented)
onCancel?: (event: InteractionEvent<T>) => void;
// (undocumented)
onComplete?: (event: InteractionEvent<T>) => void;
// (undocumented)
onEnd?: (event: InteractionEvent<T>) => void;
// (undocumented)
onInterrupt?: (event: InteractionEvent<T>) => void;
// (undocumented)
onStart?: (event: InteractionEvent<T>) => void;
// (undocumented)
onUpdate?: (event: InteractionEvent<T>) => void;
}

// @public
export type InteractionInfo<T extends object = object> = InteractionEventHandlers & T;

// @public
export function intersectCircleCircle(c1: VecLike, r1: number, c2: VecLike, r2: number): Vec[];

Expand Down
Loading
Loading