Skip to content

Commit

Permalink
dropin link positioning cables-gl/cables/issues/6760
Browse files Browse the repository at this point in the history
  • Loading branch information
pandrr committed Jan 9, 2025
1 parent 39d9d78 commit 5de0d51
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ui/glpatch/glop.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,13 @@ export default class GlOp extends Events

if (!this._op || !oldUiAttribs || !oldUiAttribs.translate) return;


let changed =
oldUiAttribs.translate.x != this._op.uiAttribs.translate.x ||
oldUiAttribs.translate.y != this._op.uiAttribs.translate.y;



// if (this._preDragPosZ != this._glRectBg.z)
// this._glRectBg.setPosition(this._glRectBg.x, this._glRectBg.y, this._preDragPosZ);

Expand Down Expand Up @@ -311,6 +314,7 @@ export default class GlOp extends Events

gui.patchView.testCollision(this._op);


undo.endGroup(undoGroup, "Move Ops");
}
}
Expand Down
20 changes: 19 additions & 1 deletion src/ui/glpatch/glpatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,16 @@ export default class GlPatch extends Events

const border = 5;
this._dropInOpBorder.setSize(this._selectedGlOps[i].w + border * 2, this._selectedGlOps[i].h + border * 2);

// console.log("dragen2222!!!!!!", this._op.uiAttribs.translate.x, this._glPatch.snap.snapOpX(this._op.uiAttribs.translate.x, this._op));

// this._glPatch.patchAPI.setOpUiAttribs(this._id, "translate", { "x": this._glPatch.snap.snapOpX(this._op.uiAttribs.translate.x, this._op), "y": this._glPatch.snap.snapY(this._op.uiAttribs.translate.y) });


this._dropInOpBorder.setPosition(this._selectedGlOps[i].x - border, this._selectedGlOps[i].y - border);



this._dropInOpBorder.setColor(this._dropInCircleRect.color);
this._dropInOpBorder.setOpacity(0.35);
}
Expand Down Expand Up @@ -808,7 +817,16 @@ export default class GlPatch extends Events
if (this.selectedGlOps[i].isHovering()) // && this.selectedGlOps[i].isDragging
{
const coord = this.screenToPatchCoord(e.offsetX, e.offsetY);
gui.patchView.insertOpInLink(this._dropInCircleLink.link, this.selectedGlOps[i].op, Snap.snapOpPosX(coord[0]), Snap.snapOpPosY(coord[1]));
gui.patchView.insertOpInLink(this._dropInCircleLink.link, this.selectedGlOps[i].op, coord[0], coord[1]);

this._selectedGlOps[i].op.setUiAttribs(
{
"translate":
{
"x": this.snap.snapOpX(this._selectedGlOps[i].op.uiAttribs.translate.x, this._selectedGlOps[i].op, 100),
"y": coord[1]
} });

return;
}
}
Expand Down

0 comments on commit 5de0d51

Please sign in to comment.