Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves #3849 #3850

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions js/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -2913,13 +2913,17 @@ class Block {
y: Math.round(that.container.y - that.original.y)
};
});

/**
* Handles the pressmove event on the block container.
* @param {Event} event - The pressmove event.
*/
this.container.on("pressmove", (event) =>{
// FIXME: More voodoo

let disX = Math.abs(event.stageX / that.activity.getStageScale() - that.original.x);
let disY = Math.abs(event.stageY / that.activity.getStageScale() - that.original.y);

event.nativeEvent.preventDefault();

// Don't allow silence block to be dragged out of a note.
Expand All @@ -2946,7 +2950,9 @@ class Block {
}

if (window.hasMouse) {
moved = true;
//check for shaky movements
if(disX > 2 || disY > 2) {
moved = true;}
} else {
// Make it eaiser to select text on mobile.
setTimeout(() => {
Expand Down Expand Up @@ -2974,7 +2980,7 @@ class Block {
if (that.activity.blocksContainer.y === 0 && finalPos < 45) {
dy += 45 - finalPos;
}

// scroll when reached edges.
if (event.stageX < 10 && that.activity.scrollBlockContainer)
that.blocks.moveAllBlocksExcept(that, 10, 0);
Expand Down