MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / NoteResizing

Class NoteResizing

apps/client/src/code/pages/page/notes/resizing.ts:10–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import type { PageNote } from './note';
9
10export class NoteResizing {
11 readonly page: Page;
12
13 side!: NoteSide;
14 section!: NoteSection | null;
15
16 constructor(input: { page: Page }) {
17 this.page = input.page;
18 }
19
20 async start(
21 event: PointerEvent,
22 note: PageNote,
23 side: NoteSide,
24 section?: NoteSection,
25 ) {
26 if (this.page.react.readOnly) {
27 return;
28 }
29
30 this.side = side;
31 this.section = section ?? null;
32
33 this.page.activeElem.set(note);
34
35 for (const selectedNote of this.page.selection.react.notes) {
36 const worldRect = selectedNote.getWorldRect('note-frame');
37
38 if (worldRect == null) {
39 continue;
40 }
41
42 let resizeRect;
43
44 if (this.section != null && note.react.collab[this.section].enabled) {
45 const sectionRect = note.getWorldRect(`note-${this.section}-section`);
46
47 if (sectionRect == null) {
48 continue;
49 }
50
51 resizeRect = new Rect(
52 new Vec2(worldRect.topLeft.x, sectionRect.topLeft.y),
53 new Vec2(worldRect.bottomRight.x, sectionRect.bottomRight.y),
54 );
55 } else {
56 resizeRect = worldRect;
57 }
58
59 selectedNote.react.resizing = {
60 oldWorldRect: new Rect(worldRect),
61 newWorldRect: new Rect(worldRect),
62
63 section,
64
65 oldResizeRect: new Rect(resizeRect),
66 newResizeRect: new Rect(resizeRect),
67 };

Callers

nothing calls this directly

Calls 5

isCtrlDownFunction · 0.90
eventToWorldMethod · 0.80
subMethod · 0.80
mulMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected