add cut off
Browse files20 unmodified lines21222324252696 unmodified lines123124125126127128162 unmodified lines291292293294295296297101 unmodified lines39940040140240340440540640720 unmodified linesreturn limbIndex === -1 ? -1 : limbSeq[limbIndex][0];}function repairPose(sourcePose) {// TODO: ループには対応してないかもvar pose = sourcePose;96 unmodified linesRedraw();}// ドラッグ中の各キーが押されているかどうかのフラグvar keyDownFlags = {};// マウスカーソル162 unmodified lines"ControlRight": "Scale","ShiftLeft": "Rotate","ShiftRight": "Rotate","KeyQ": "Delete","KeyX": "X-Axis","KeyC": "Y-Axis","KeyR": "Repair",101 unmodified linesconst p = getCanvasPosition(event);const [personIndex, nodeIndex, minDist] = getNearestNode(p);if (keyDownFlags["KeyQ"]) {removePerson(personIndex);return;}if (keyDownFlags["KeyR"]) {repairPerson(personIndex);return;}// ドラッグ処理の開始dragStart = p;dragMarks = poseData.map(pose => pose.map(node => false));20 unmodified lines2122232425262728293031323334353637383940414243444596 unmodified lines142143144145146147148149150151152153154155162 unmodified lines318319320321322323324325101 unmodified lines42742842943043143243343443543643743843944020 unmodified linesreturn limbIndex === -1 ? -1 : limbSeq[limbIndex][0];}function cutOffLimb(pose, cutOffIndex) {console.log(`cutOffLimb: ${cutOffIndex}`);// 末端ノードの座標を削除するvar newPose = deepCopy(pose);for (let i = 0; i < 18; i++) {// ルートまで検索し、その間にcuttOffIndexがあれば削除if (i == 1) {continue;} // ルートは削除しないwhile (true) {let parent = findParentNodeIndex(i);if (parent === cutOffIndex) {console.log(`cutOffLimb: ${i} -> ${cutOffIndex}`);newPose[i] = null;break;}}}return newPose;}function repairPose(sourcePose) {// TODO: ループには対応してないかもvar pose = sourcePose;96 unmodified linesRedraw();}function cutOffPersonLimb(personIndex, limbIndex) {poseData[personIndex] = cutOffLimb(poseData[personIndex], limbIndex);console.log(poseData[personIndex]);console.log(poseData);addHistory();Redraw();}// ドラッグ中の各キーが押されているかどうかのフラグvar keyDownFlags = {};// マウスカーソル162 unmodified lines"ControlRight": "Scale","ShiftLeft": "Rotate","ShiftRight": "Rotate","KeyQ": "CutOff","KeyD": "Delete","KeyX": "X-Axis","KeyC": "Y-Axis","KeyR": "Repair",101 unmodified linesconst p = getCanvasPosition(event);const [personIndex, nodeIndex, minDist] = getNearestNode(p);if (keyDownFlags["KeyD"]) {removePerson(personIndex);return;}if (keyDownFlags["KeyR"]) {repairPerson(personIndex);return;}if (keyDownFlags["KeyQ"] && minDist < 16 && nodeIndex != 1) {cutOffPersonLimb(personIndex, nodeIndex);return;}// ドラッグ処理の開始dragStart = p;dragMarks = poseData.map(pose => pose.map(node => false));
static/poseEditor.js+35-2