json-schema: PHYスキーマを相対座標モデルとKLE往復の決定に合わせる
cd6a94f(相対座標・回転中心なし)と 1a9a2a0(KLE往復は照合)の反映漏れを直す。 - position を $defs/transform (x, y, rotation) に置き換え、rotationOrigin を削除 - size を width/height から w/h に揃え、親の変換を受けないことを明記 - elements を root / children に改名 - kleCompatibility.originalIndex を削除(KLEは保存時にキーを並べ替える) - 使用例を新しい形に更新し、スキーマで検証が通ることを確認 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+36
-61
@@ -10,6 +10,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
|
||||
## 1. PHYレイヤー JSON Schema
|
||||
|
||||
座標・回転・サイズの意味は `PHYレイヤー.md` を正とする。
|
||||
|
||||
### 基本構造
|
||||
|
||||
```json
|
||||
@@ -19,7 +21,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"title": "PHY Layer - Physical Key Layout",
|
||||
"description": "Physical positioning and sizing of keys",
|
||||
"type": "object",
|
||||
"required": ["version", "metadata", "profiles", "elements"],
|
||||
"required": ["version", "metadata", "profiles", "root"],
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
@@ -61,7 +63,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"$ref": "#/$defs/profile"
|
||||
}
|
||||
},
|
||||
"elements": {
|
||||
"root": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
@@ -72,6 +74,16 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"transform": {
|
||||
"type": "object",
|
||||
"description": "Placement relative to the parent: rotate by rotation around the local origin, then translate by (x, y)",
|
||||
"required": ["x", "y", "rotation"],
|
||||
"properties": {
|
||||
"x": { "type": "number" },
|
||||
"y": { "type": "number" },
|
||||
"rotation": { "type": "number", "description": "Degrees" }
|
||||
}
|
||||
},
|
||||
"profile": {
|
||||
"type": "object",
|
||||
"required": ["id", "name", "unitSize"],
|
||||
@@ -98,7 +110,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
},
|
||||
"key": {
|
||||
"type": "object",
|
||||
"required": ["type", "id", "profile", "position", "size"],
|
||||
"required": ["type", "id", "profile", "transform", "size"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
@@ -112,28 +124,14 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"type": "string",
|
||||
"description": "Reference to profile ID"
|
||||
},
|
||||
"position": {
|
||||
"type": "object",
|
||||
"required": ["x", "y"],
|
||||
"properties": {
|
||||
"x": { "type": "number" },
|
||||
"y": { "type": "number" },
|
||||
"rotation": { "type": "number" },
|
||||
"rotationOrigin": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": { "type": "number" },
|
||||
"y": { "type": "number" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"transform": { "$ref": "#/$defs/transform" },
|
||||
"size": {
|
||||
"type": "object",
|
||||
"required": ["width", "height"],
|
||||
"description": "Local size. Not affected by the parent transform",
|
||||
"required": ["w", "h"],
|
||||
"properties": {
|
||||
"width": { "type": "number", "minimum": 0 },
|
||||
"height": { "type": "number", "minimum": 0 }
|
||||
"w": { "type": "number", "minimum": 0 },
|
||||
"h": { "type": "number", "minimum": 0 }
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
@@ -146,7 +144,6 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"type": "object",
|
||||
"description": "Original KLE fields for round-trip compatibility",
|
||||
"properties": {
|
||||
"originalIndex": { "type": "integer" },
|
||||
"labels": { "type": "array", "items": { "type": "string" } },
|
||||
"textSizes": { "type": "array", "items": { "type": "number" } },
|
||||
"decalData": { "type": "object" }
|
||||
@@ -158,7 +155,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
},
|
||||
"cluster": {
|
||||
"type": "object",
|
||||
"required": ["type", "id", "name", "elements"],
|
||||
"required": ["type", "id", "name", "transform", "children"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
@@ -166,22 +163,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
},
|
||||
"id": { "type": "string" },
|
||||
"name": { "type": "string" },
|
||||
"position": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": { "type": "number" },
|
||||
"y": { "type": "number" },
|
||||
"rotation": { "type": "number" },
|
||||
"rotationOrigin": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": { "type": "number" },
|
||||
"y": { "type": "number" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"elements": {
|
||||
"transform": { "$ref": "#/$defs/transform" },
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
@@ -215,31 +198,27 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"visualOffset": { "x": 1, "y": 1, "radius": 1 }
|
||||
}
|
||||
],
|
||||
"elements": [
|
||||
"root": [
|
||||
{
|
||||
"type": "cluster",
|
||||
"id": "left_main",
|
||||
"name": "Left Main Block",
|
||||
"position": {
|
||||
"x": 0, "y": 0,
|
||||
"rotation": 0,
|
||||
"rotationOrigin": { "x": 3, "y": 2 }
|
||||
},
|
||||
"elements": [
|
||||
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||
"children": [
|
||||
{
|
||||
"type": "key",
|
||||
"id": "k00",
|
||||
"profile": "standard",
|
||||
"position": { "x": 0, "y": 0 },
|
||||
"size": { "width": 1, "height": 1 },
|
||||
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1, "h": 1 },
|
||||
"metadata": { "label": "Q" }
|
||||
},
|
||||
{
|
||||
"type": "key",
|
||||
"id": "k01",
|
||||
"profile": "standard",
|
||||
"position": { "x": 1, "y": 0 },
|
||||
"size": { "width": 1, "height": 1 },
|
||||
"transform": { "x": 1, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1, "h": 1 },
|
||||
"metadata": { "label": "W" }
|
||||
}
|
||||
]
|
||||
@@ -248,26 +227,22 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"type": "cluster",
|
||||
"id": "left_thumb",
|
||||
"name": "Left Thumb Cluster",
|
||||
"position": {
|
||||
"x": 2, "y": 3,
|
||||
"rotation": 15,
|
||||
"rotationOrigin": { "x": 1, "y": 0.5 }
|
||||
},
|
||||
"elements": [
|
||||
"transform": { "x": 2, "y": 3, "rotation": 15 },
|
||||
"children": [
|
||||
{
|
||||
"type": "key",
|
||||
"id": "k30",
|
||||
"profile": "standard",
|
||||
"position": { "x": 0, "y": 0 },
|
||||
"size": { "width": 1.25, "height": 1 },
|
||||
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1.25, "h": 1 },
|
||||
"metadata": { "label": "Space" }
|
||||
},
|
||||
{
|
||||
"type": "key",
|
||||
"id": "k31",
|
||||
"profile": "standard",
|
||||
"position": { "x": 1.25, "y": 0 },
|
||||
"size": { "width": 1, "height": 1 },
|
||||
"transform": { "x": 1.25, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1, "h": 1 },
|
||||
"metadata": { "label": "Enter" }
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user