Mouse Over Floanting Profiles
This commit is contained in:
1 parent
07e4b00756
commit
6134567e5e
2 files changed
+102
No files matched your search
@@ -488,6 +488,10 @@ function newCanvas() {
|
||||
dragVector.upY = event.pageY;
|
||||
|
||||
checkDrag();
|
||||
} else {
|
||||
|
||||
onMouseOver(event);
|
||||
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
@@ -497,6 +501,85 @@ function newCanvas() {
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseOver(event) {
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onMouseOver -> Entering function."); }
|
||||
|
||||
/* First we raise the event signaling theat the mouse is potentially over another item, so that the current item can turn itself off. */
|
||||
|
||||
thisObject.eventHandler.raiseEvent("onMouseNotOver");
|
||||
|
||||
/* Then we check who is the current object underneeth the mounse. */
|
||||
|
||||
let point = {
|
||||
x: event.pageX,
|
||||
y: event.pageY
|
||||
};
|
||||
|
||||
let container;
|
||||
|
||||
/* We check if the mouse is over an element of the Top Space / */
|
||||
|
||||
container = thisObject.topSpace.getContainer(point);
|
||||
|
||||
if (container !== undefined && container.isClickeable === true) {
|
||||
|
||||
container.eventHandler.raiseEvent('onMouseOver', point);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We check if the mouse is over an element of the Bottom Space / */
|
||||
|
||||
container = thisObject.bottomSpace.getContainer(point);
|
||||
|
||||
if (container !== undefined && container.isClickeable === true) {
|
||||
|
||||
container.eventHandler.raiseEvent('onMouseOver', point);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We check if the mouse is over a panel/ */
|
||||
|
||||
container = thisObject.panelsSpace.getContainer(point);
|
||||
|
||||
if (container !== undefined && container.isClickeable === true) {
|
||||
|
||||
container.eventHandler.raiseEvent('onMouseOver', point);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We check if the mouse is over a floatingObject/ */
|
||||
|
||||
let floatingObjectBeingClicked = thisObject.floatingSpace.floatingLayer.isInside(event.pageX, event.pageY);
|
||||
|
||||
if (floatingObjectBeingClicked >= 0) {
|
||||
|
||||
let floatingObject = thisObject.floatingSpace.floatingLayer.getFloatingObject(undefined, floatingObjectBeingClicked);
|
||||
floatingObject.eventHandler.raiseEvent('onMouseOver', point);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/* If it is not, then we check if it is over any of the existing containers at the Chart Space. */
|
||||
|
||||
container = thisObject.chartSpace.getContainer(point);
|
||||
|
||||
if (container !== undefined && container.isClickeable === true) {
|
||||
|
||||
container.eventHandler.raiseEvent('onMouseOver', point);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] onMouseOver -> err = " + err); }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseWheel(event) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -3,6 +3,8 @@ function newFloatingObject() {
|
||||
|
||||
var thisObject = {
|
||||
|
||||
eventHandler: undefined,
|
||||
|
||||
payload: undefined, // This is a reference to an object controlled by a Plotter. The plotter can change its internal value and we will see them from here.
|
||||
type: undefined, // Currently there are two types of Floating Objects: Profile Balls, and Notes.
|
||||
|
||||
@@ -49,6 +51,8 @@ function newFloatingObject() {
|
||||
|
||||
let underlayingObject;
|
||||
|
||||
thisObject.eventHandler = newEventHandler();
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(pType, callBackFunction) {
|
||||
@@ -86,9 +90,24 @@ function newFloatingObject() {
|
||||
|
||||
thisObject.type = pType;
|
||||
|
||||
thisObject.eventHandler.listenToEvent("onMouseOver", onMouseOver);
|
||||
canvas.eventHandler.listenToEvent("onMouseNotOver", onMouseNotOver);
|
||||
|
||||
callBackFunction();
|
||||
}
|
||||
|
||||
function onMouseOver() {
|
||||
|
||||
thisObject.targetRadius = thisObject.rawRadius * 2;
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 2;
|
||||
}
|
||||
|
||||
function onMouseNotOver() {
|
||||
|
||||
thisObject.targetRadius = thisObject.rawRadius * 1;
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 1;
|
||||
}
|
||||
|
||||
function drawBackground() {
|
||||
|
||||
underlayingObject.drawBackground(thisObject);
|
||||
|
||||
Reference in new issue
Block a user