support undetected nodes
Browse filesFiles changed (2)
- app.py+1-1
- static/poseEditor.js+18-11
94 unmodified lines959697989910010194 unmodified lines| Import | Paste json to "Json source" and click "Import Json", edit the width/height, then click "Start edit". || Export | click "Save" and "Copy to clipboard" of "Json" section. |""")json = gr.JSON(label="Json", lines=10)jsonInput = gr.Textbox(label="Json source", lines=10)jsonInputBtn = gr.Button(value="Import Json")with gr.Column(scale=2):94 unmodified lines959697989910010194 unmodified lines| Import | Paste json to "Json source" and click "Import Json", edit the width/height, then click "Start edit". || Export | click "Save" and "Copy to clipboard" of "Json" section. |""")json = gr.JSON(label="Json")jsonInput = gr.Textbox(label="Json source", lines=10)jsonInputBtn = gr.Button(value="Import Json")with gr.Column(scale=2):
24 unmodified lines2526272829303161 unmodified lines939495969798991005 unmodified lines10610710810911011111237 unmodified lines15015115215315415515676 unmodified lines2332342352362372382392404 unmodified lines24524624724824925025125224 unmodified lines27727827928028128228328428524 unmodified linesfunction makePoseFromCandidateAndSubsetElement(candidate, subsetElement) {var pose = [];for (let j = 0 ; j < 18; j++) {pose.push(candidate[subsetElement[j]]);}return pose;}61 unmodified lines// edgefor (let j = 0; j < 17; j++) {const [X0, Y0] = pose[limbSeq[j][0]-1];const [X1, Y1] = pose[limbSeq[j][1]-1];ctx.beginPath();ctx.lineWidth=stickWidth;ctx.strokeStyle = `rgb(${colors[j].join(',')})`;5 unmodified lines// nodectx.font = '12px serif';for (let j = 0; j < 18; j++) {const [x, y] = pose[j];ctx.beginPath();ctx.arc(x, y, stickWidth*1.2, 0, 2 * Math.PI);ctx.fillStyle = `rgb(${colors[j].join(',')})`;37 unmodified linesfor (let i = 0; i < poseData.length; i++) {const pose = poseData[i];for (let j = 0; j < pose.length; j++) {const d = distSq(p, pose[j]);if (d < minDistSq) {minDistSq = d;personIndex = i;76 unmodified linesif (event.altKey || event.ctrlKey || event.shiftKey) {// dragMarksを設定dragMarks[personIndex] = dragMarks[personIndex].map((node) => true);isDragging = true;if (event.altKey) {dragMode = "move";} else if (event.ctrlKey) {4 unmodified lines}} else if (keyDownFlags["Space"]) {dragMarks[personIndex] =dragMarks[personIndex].map((node) => distSq(p, node) < dragRange ** 2);isDragging = dragMarks[personIndex].some((mark) => mark);dragMode = "move";} else if (minDist < 16) {24 unmodified linesrotateBaseVector = dragOffset;if (!event.shiftKey) {dragMode = "rotate2";console.log("rotate2");}console.log("!");} else if (dragMode == "rotate2") {// 回転let angle = directedAngleTo(rotateBaseVector, dragOffset);24 unmodified lines252627282930313261 unmodified lines9495969798991001011021031045 unmodified lines11011111211311411511611711837 unmodified lines15615715815916016116216316476 unmodified lines2412422432442452462472482494 unmodified lines25425525625725825926026124 unmodified lines28628728828929029129224 unmodified linesfunction makePoseFromCandidateAndSubsetElement(candidate, subsetElement) {var pose = [];for (let j = 0 ; j < 18; j++) {let i = subsetElement[j];pose.push(i < 0 ? null : candidate[i]);}return pose;}61 unmodified lines// edgefor (let j = 0; j < 17; j++) {const p = pose[limbSeq[j][0]-1];const q = pose[limbSeq[j][1]-1];if (p == null || q == null) continue;const [X0, Y0] = p;const [X1, Y1] = q;ctx.beginPath();ctx.lineWidth=stickWidth;ctx.strokeStyle = `rgb(${colors[j].join(',')})`;5 unmodified lines// nodectx.font = '12px serif';for (let j = 0; j < 18; j++) {const p = pose[j];if (p == null) continue;const [x, y] = p;ctx.beginPath();ctx.arc(x, y, stickWidth*1.2, 0, 2 * Math.PI);ctx.fillStyle = `rgb(${colors[j].join(',')})`;37 unmodified linesfor (let i = 0; i < poseData.length; i++) {const pose = poseData[i];for (let j = 0; j < pose.length; j++) {const q = pose[j];if (q == null) continue;const d = distSq(p, q);if (d < minDistSq) {minDistSq = d;personIndex = i;76 unmodified linesif (event.altKey || event.ctrlKey || event.shiftKey) {// dragMarksを設定dragMarks[personIndex] =poseData[personIndex].map((node) => node != null);isDragging = true;if (event.altKey) {dragMode = "move";} else if (event.ctrlKey) {4 unmodified lines}} else if (keyDownFlags["Space"]) {dragMarks[personIndex] =poseData[personIndex].map((node) => node != null && distSq(p, node) < dragRange ** 2);isDragging = dragMarks[personIndex].some((mark) => mark);dragMode = "move";} else if (minDist < 16) {24 unmodified linesrotateBaseVector = dragOffset;if (!event.shiftKey) {dragMode = "rotate2";}} else if (dragMode == "rotate2") {// 回転let angle = directedAngleTo(rotateBaseVector, dragOffset);
app.py+1-1
static/poseEditor.js+18-11