Skip to content

Commit

Permalink
Merge pull request #2481 from UltimateHackingKeyboard/fix-drag-and-drop
Browse files Browse the repository at this point in the history
fix: drag and drop of keyaction
  • Loading branch information
mondalaci authored Jan 5, 2025
2 parents 0dfde7b + ed7a4ae commit 688291e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ export class KeyActionDragAndDropService implements OnDestroy {
const clonedElement = this.lefButtonDownOptions.element.cloneNode(true) as SVGElement;
clonedElement.setAttribute('dragging', 'true');
if (box.width < 63) {
const translateX = translateKey + Math.abs(box.x) + 31.5 - box.width / 2;
clonedElement.setAttribute('transform', `translate(${translateX},${translateKey + Math.abs(box.y)})`);
const translateX = translateKey + (box.x * -1) + 31.5 - box.width / 2;
clonedElement.setAttribute('transform', `translate(${translateX},${translateKey + (box.y * -1)})`);
} else {
clonedElement.setAttribute('transform', `translate(${translateKey + Math.abs(box.x)},${translateKey + Math.abs(box.y)})`);
clonedElement.setAttribute('transform', `translate(${translateKey + (box.x * -1)},${translateKey + (box.y * -1)})`);
}

this.lefButtonDownOptions.element.style.visibility = 'hidden';
Expand Down Expand Up @@ -380,7 +380,7 @@ function getLayerId(element: Element): number | undefined {
}

function convertKeyIdToNumber(keyId: string): number {
return parseInt(keyId.split('-').pop()) - 1;
return parseInt(keyId.split('-').pop());
}

function isDropElement(element: Element): boolean {
Expand Down

0 comments on commit 688291e

Please sign in to comment.