diff --git a/content/commands.csv b/content/commands.csv index 98899e7..6c1db79 100644 --- a/content/commands.csv +++ b/content/commands.csv @@ -1,4 +1,6 @@ command,parameter,label,description,insertedText +roll,emmet,2d6,2D6,2d6 +roll,emmet,d20,D20,d20 track,emmet,monk,破戒佛爷,"破戒佛爷.bandit.monk[gd=4/4,str=14/14,cla=10,spi=8]" track,emmet,bandit,龙虎寨山贼,"龙虎寨山贼.bandit[gd=2/2,str=10/10,cla=10,spi=10]" track,emmet,khitan,契丹护卫,"契丹护卫.khitan.guard[gd=4/4,ap=2,str=14/14,cla=14,spi=14]" \ No newline at end of file diff --git a/src/components/md-commander/AttributeTooltip.tsx b/src/components/md-commander/AttributeTooltip.tsx index f49f4af..b2091e2 100644 --- a/src/components/md-commander/AttributeTooltip.tsx +++ b/src/components/md-commander/AttributeTooltip.tsx @@ -32,6 +32,24 @@ export const AttributeTooltip: Component = (props) => { props.onUpdate(attrName, { ...attr, value }); }; + // 处理滚轮增减(progress 和 count 类型) + const handleWheel = (e: WheelEvent, attrName: string, attr: TrackerAttribute) => { + e.preventDefault(); + e.stopPropagation(); + + if (attr.type === "count") { + const delta = e.deltaY > 0 ? -1 : 1; + const newValue = Math.max(0, (attr.value as number) + delta); + handleUpdate(attrName, newValue); + } else if (attr.type === "progress") { + const val = attr.value as { x: number; y: number }; + const delta = e.deltaY > 0 ? -1 : 1; + // 滚轮向上/下调整当前值 x + const newX = Math.max(0, Math.min(val.y, val.x + delta)); + handleUpdate(attrName, { x: newX, y: val.y }); + } + }; + // 添加 class const handleAddClass = () => { const className = newClass().trim(); @@ -56,7 +74,11 @@ export const AttributeTooltip: Component = (props) => { return (
{/* 进度条 */} -
+
handleWheel(e, attrName, attr)} + >
= (props) => { type="number" value={val.x} onChange={(e) => handleUpdate(attrName, { x: parseInt(e.target.value) || 0, y: val.y })} + onWheel={(e) => handleWheel(e, attrName, attr)} class="w-14 px-1 py-0.5 border border-gray-300 rounded text-center text-sm" min="0" /> @@ -87,7 +110,11 @@ export const AttributeTooltip: Component = (props) => { if (attr.type === "count") { const value = attr.value as number; return ( -
+
handleWheel(e, attrName, attr)} + title="滚动鼠标滚轮增减" + >