mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-26 06:04:08 +00:00
chore(memory-graph): trim comments in community fixes
This commit is contained in:
parent
cd6ea514d1
commit
2dbf02018f
8 changed files with 0 additions and 25 deletions
|
|
@ -155,7 +155,6 @@ describe("InputHandler touch tap-to-select", () => {
|
|||
expect(dragEnds).toBe(1)
|
||||
expect(testNode.fx).toBeNull()
|
||||
expect(testNode.fy).toBeNull()
|
||||
// no tap click should fire after a real drag
|
||||
expect(clicks).toEqual([])
|
||||
})
|
||||
|
||||
|
|
@ -185,11 +184,9 @@ describe("InputHandler touch tap-to-select", () => {
|
|||
viewport.zoomImmediate(0.25, 0, 0)
|
||||
|
||||
fire("touchstart", touchEvent([touch(25, 25)]))
|
||||
// 8px screen jitter (below the 10px tap threshold)
|
||||
fire("touchmove", touchEvent([touch(33, 25)]))
|
||||
fire("touchend", touchEvent([]))
|
||||
|
||||
// the tap resolves the node under the finger at touchstart
|
||||
expect(clicks).toEqual(["doc-1"])
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
/**
|
||||
* Mounted-render verification for the Minimap: it should render a canvas and
|
||||
* survive an environment where the 2D context is unavailable (happy-dom).
|
||||
*/
|
||||
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { createRef } from "react"
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ describe("computeMinimapLayout", () => {
|
|||
120,
|
||||
10,
|
||||
)
|
||||
// avail = 100, world = 100 => scale 1
|
||||
expect(layout.scale).toBeCloseTo(1)
|
||||
// corners land on the padding edge
|
||||
expect(worldToMinimap(0, 0, layout)).toEqual({ x: 10, y: 10 })
|
||||
expect(worldToMinimap(100, 100, layout)).toEqual({ x: 110, y: 110 })
|
||||
})
|
||||
|
|
@ -29,11 +27,9 @@ describe("computeMinimapLayout", () => {
|
|||
120,
|
||||
10,
|
||||
)
|
||||
// avail 100 x 100; width is the binding dimension => scale 0.5
|
||||
expect(layout.scale).toBeCloseTo(0.5)
|
||||
const topLeft = worldToMinimap(0, 0, layout)
|
||||
const bottomRight = worldToMinimap(200, 100, layout)
|
||||
// horizontally flush to padding, vertically centered (content height 50)
|
||||
expect(topLeft.x).toBeCloseTo(10)
|
||||
expect(bottomRight.x).toBeCloseTo(110)
|
||||
expect(topLeft.y).toBeCloseTo(35)
|
||||
|
|
@ -87,7 +83,6 @@ describe("computeViewportRect", () => {
|
|||
)
|
||||
|
||||
it("maps the visible world region to a minimap rectangle", () => {
|
||||
// zoom 1, no pan => the canvas shows world [0..100] x [0..100]
|
||||
const rect = computeViewportRect(
|
||||
{ panX: 0, panY: 0, zoom: 1 },
|
||||
100,
|
||||
|
|
@ -101,7 +96,6 @@ describe("computeViewportRect", () => {
|
|||
})
|
||||
|
||||
it("shrinks the rectangle as the main view zooms in", () => {
|
||||
// zoom 2 => the canvas shows only half the world span in each axis
|
||||
const rect = computeViewportRect(
|
||||
{ panX: 0, panY: 0, zoom: 2 },
|
||||
100,
|
||||
|
|
@ -119,7 +113,6 @@ describe("computeViewportRect", () => {
|
|||
100,
|
||||
layout,
|
||||
)
|
||||
// panning the world content left by 20 screen px moves the visible region right
|
||||
const panned = computeViewportRect(
|
||||
{ panX: -20, panY: 0, zoom: 1 },
|
||||
100,
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ describe("ViewportState reduced-motion", () => {
|
|||
vp.centerOn(500, 500, 800, 600)
|
||||
const moved = vp.tick()
|
||||
expect(moved).toBe(true)
|
||||
// target = width/2 - worldX*zoom = 400 - 500 = -100, etc.
|
||||
expect(vp.panX).toBe(-100)
|
||||
expect(vp.panY).toBe(-200)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// Pure, canvas-free geometry for the graph minimap.
|
||||
|
||||
export interface MinimapBounds {
|
||||
minX: number
|
||||
minY: number
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ export class ForceSimulation {
|
|||
: FORCE_CONFIG.preSettleTicks
|
||||
for (let i = 0; i < preSettleTicks; i++) this.sim.tick()
|
||||
|
||||
// Dense graphs stay static for perf; reduced-motion reuses that path.
|
||||
if (
|
||||
nodes.length > DENSE_GRAPH_STATIC_THRESHOLD ||
|
||||
prefersReducedMotion()
|
||||
|
|
@ -92,7 +91,6 @@ export class ForceSimulation {
|
|||
}
|
||||
|
||||
reheat(): void {
|
||||
// Dragged node still moves via InputHandler; neighbours stay put.
|
||||
if (prefersReducedMotion()) return
|
||||
this.holdingHeat = true
|
||||
this.sim?.on("tick.settle", null)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ export class ViewportState {
|
|||
private static readonly MAX_ZOOM = 5.0
|
||||
private minZoom = ViewportState.DEFAULT_MIN_ZOOM
|
||||
|
||||
// Cached query; `.matches` still tracks live OS changes.
|
||||
private readonly reducedMotionQuery: MediaQueryList | null =
|
||||
typeof globalThis.matchMedia === "function"
|
||||
? globalThis.matchMedia("(prefers-reduced-motion: reduce)")
|
||||
|
|
@ -175,7 +174,6 @@ export class ViewportState {
|
|||
this.panY += dy * this.panLerp
|
||||
moving = true
|
||||
} else {
|
||||
// Reduced-motion always snaps here, so report the jump as movement.
|
||||
if (
|
||||
reduced &&
|
||||
(this.panX !== this.targetPanX || this.panY !== this.targetPanY)
|
||||
|
|
|
|||
|
|
@ -157,7 +157,6 @@ export function computeClusterAssignments(
|
|||
|
||||
const component: string[] = []
|
||||
const queue = [startId]
|
||||
// index dequeue: shift() is O(n) per call, O(n^2) on wide components
|
||||
let head = 0
|
||||
visited.add(startId)
|
||||
|
||||
|
|
@ -402,8 +401,6 @@ function getAppendSpatialKey(x: number, y: number): string {
|
|||
return `${x}:${y}`
|
||||
}
|
||||
|
||||
// Pure so it can be tested outside the hook.
|
||||
|
||||
export function computeEdges(documents: GraphApiDocument[]): GraphEdge[] {
|
||||
if (!documents || documents.length === 0) return []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue