Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 21 additions & 38 deletions js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -1756,25 +1756,17 @@ class Activity {
*/
this._setupBlocksContainerEvents = () => {
const moving = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does moving get defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoot, my fault.

I was probably thinking of moving the variable outside the function to do something but forgot to do so.
will revert this.

let lastCoords = {
x: 0,
y: 0,
delta: 0
};

const that = this;
let lastCoords = { x: 0, y: 0, delta: 0 };

/**
* Closes any open menus and labels.
*/
const closeAnyOpenMenusAndLabels = () => {
if (docById("wheelDiv") !== null) docById("wheelDiv").style.display = "none";
if (docById("contextWheelDiv") !== null)
docById("contextWheelDiv").style.display = "none";
if (docById("helpfulWheelDiv") !== null)
docById("helpfulWheelDiv").style.display = "none";
if (docById("textLabel") !== null) docById("textLabel").style.display = "none";
if (docById("numberLabel") !== null) docById("numberLabel").style.display = "none";
['wheelDiv', 'contextWheelDiv', 'helpfulWheelDiv', 'textLabel', 'numberLabel'].forEach(id => {
const elem = docById(id);
if (elem) elem.style.display = 'none';
});
};

/**
Expand Down Expand Up @@ -1898,30 +1890,23 @@ class Activity {
* @param {WheelEvent} event - The wheel event object.
*/
const __wheelHandler = (event) => {
const data = normalizeWheel(event); // normalize over different browsers
const data = normalizeWheel(event);
const delY = data.pixelY;
const delX = data.pixelX;

//Ctrl+MouseWheel Zoom functionality

if (event.ctrlKey) {
event.preventDefault(); // Prevent default scrolling behavior

if (delY < 0 && doLargerBlocks(this));//Zoom IN
if (delY >= 0 && doSmallerBlocks(this));//Zoom Out
}
if (delY !== 0 && event.axis === event.VERTICAL_AXIS) {
closeAnyOpenMenusAndLabels(); // closes all wheelnavs when scrolling .
event.preventDefault();
delY < 0 ? doLargerBlocks(that) : doSmallerBlocks(that);
} else if (delY !== 0 && event.axis === event.VERTICAL_AXIS) {
closeAnyOpenMenusAndLabels();
that.blocksContainer.y -= delY;
}
// horizontal scroll
if (that.scrollBlockContainer) {
if (delX !== 0 && event.axis === event.HORIZONTAL_AXIS) {
closeAnyOpenMenusAndLabels();
that.blocksContainer.x -= delX;
}
} else if (that.scrollBlockContainer && delX !== 0 && event.axis === event.HORIZONTAL_AXIS) {
closeAnyOpenMenusAndLabels();
that.blocksContainer.x -= delX;
} else {
event.preventDefault();
}

that.refreshCanvas();
};

Expand Down Expand Up @@ -1973,12 +1958,10 @@ class Activity {

that.stage.removeAllEventListeners("stagemousemove");
that.stage.on("stagemousemove", (event) => {
that.stageX = event.stageX;
that.stageY = event.stageY;

if (!moving) {
return;
}
that.stageX = moveEvent.stageX;
that.stageY = moveEvent.stageY;

if (!that.moving) return;

// if we are moving the block container, deselect the active block.
// Deselect active block if moving the block container
Expand Down Expand Up @@ -4182,7 +4165,7 @@ class Activity {
let st = sched[j].start;
let ed= sched[j].end;
let dur = ed - st;
var temp = this.getClosestStandardNoteValue(dur * 3 / 8);
let temp = this.getClosestStandardNoteValue(dur * 3 / 8);
shortestNoteDenominator=Math.max(shortestNoteDenominator,temp[1]);
}

Expand Down Expand Up @@ -4224,7 +4207,7 @@ class Activity {
}
return ar;
};
var obj = this.getClosestStandardNoteValue(duration * 3 / 8);
let obj = this.getClosestStandardNoteValue(duration * 3 / 8);
// let scalingFactor=1;
// if(shortestNoteDenominator>32)
// scalingFactor=shortestNoteDenominator/32;
Expand Down
Loading