mock: 長押しにループ方式とリスト方式を入れ、ツールバーで切り替える(T-30 単位7b)
どちらも押した位置に円形インジケータを、少し離して選択先のリストを出す。 間隔は600msで始まり1000msごとに進む(500ms/450msは早いという所感への対応)。 リスト方式は、ポインタがリストに入ると巡回を止め、離したときに指している行で確定する。 リストへ向かう動きをドラッグと取り違えないよう、リスト方式では長押し後のドラッグをしない。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ShoEXYqi8PWTjB9E86Ltot
This commit is contained in:
@@ -4,7 +4,7 @@ import type { KeyNode, Node } from "../../domain/phy";
|
||||
import { apply, worldTransform } from "../../domain/geometry";
|
||||
import { moveNode } from "../../domain/phyCommands";
|
||||
import { normalizeSelection, snap } from "./logic";
|
||||
import { usePhyLongPress } from "./usePhyLongPress";
|
||||
import { usePhyLongPress, type HoldMode } from "./usePhyLongPress";
|
||||
import { autoPanVelocity } from "./viewport";
|
||||
|
||||
type Point = { x: number; y: number };
|
||||
@@ -27,6 +27,7 @@ type Options = {
|
||||
isAncestor: (candidate: string, id: string) => boolean;
|
||||
parentLabel: (id: string | null) => string;
|
||||
pressTargets: (id: string) => string[];
|
||||
holdMode: Ref<HoldMode>;
|
||||
setSelection: (id: string, add?: boolean) => void;
|
||||
beginHistory: () => void;
|
||||
commitHistory: () => void;
|
||||
@@ -34,7 +35,7 @@ type Options = {
|
||||
};
|
||||
|
||||
export function usePhyCanvasPointer(options: Options) {
|
||||
const longPress = usePhyLongPress(options);
|
||||
const longPress = usePhyLongPress({ ...options, mode: () => options.holdMode.value });
|
||||
const spaceHeld = ref(false);
|
||||
let preClickSelection: string[] = [];
|
||||
let preClickTarget: string | null = null;
|
||||
@@ -238,6 +239,10 @@ export function usePhyCanvasPointer(options: Options) {
|
||||
}
|
||||
if (!dragState) return;
|
||||
lastPointer = { x: event.clientX, y: event.clientY };
|
||||
if (longPress.picking()) {
|
||||
longPress.point(event.clientX, event.clientY);
|
||||
return;
|
||||
}
|
||||
const state = dragState;
|
||||
if (Math.hypot(event.clientX - state.start.x, event.clientY - state.start.y) < 4) return;
|
||||
longPress.cancelPending();
|
||||
@@ -373,11 +378,17 @@ export function usePhyCanvasPointer(options: Options) {
|
||||
move,
|
||||
up,
|
||||
spaceUp,
|
||||
longLabel: longPress.label,
|
||||
longLabelPos: longPress.labelPos,
|
||||
hold: {
|
||||
open: longPress.open,
|
||||
mode: longPress.mode,
|
||||
pos: longPress.pos,
|
||||
candidates: longPress.candidates,
|
||||
names: longPress.names,
|
||||
index: longPress.index,
|
||||
step: longPress.step,
|
||||
pointing: longPress.pointing,
|
||||
},
|
||||
spaceHeld,
|
||||
holdCandidates: longPress.candidates,
|
||||
holdIndex: longPress.index,
|
||||
priorSelection,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user