Mouse Wheel Working
This commit is contained in:
1 parent
99094491de
commit
b8eecf19fc
3 files changed
+29
-41
No files matched your search
+22
-39
@@ -10,7 +10,8 @@ function newListView () {
|
||||
listItems: [],
|
||||
payload: undefined,
|
||||
isVisible: false,
|
||||
reload: reload,
|
||||
turnOn: turnOn,
|
||||
turnOff: turnOff,
|
||||
physics: physics,
|
||||
draw: draw,
|
||||
getContainer: getContainer,
|
||||
@@ -80,10 +81,10 @@ function newListView () {
|
||||
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
|
||||
onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
|
||||
|
||||
reload()
|
||||
turnOn()
|
||||
}
|
||||
|
||||
function reload () {
|
||||
function turnOn () {
|
||||
callServer(undefined, 'ListWorkspaces', onResponse)
|
||||
|
||||
function onResponse (err, text) {
|
||||
@@ -103,10 +104,16 @@ function newListView () {
|
||||
|
||||
thisObject.listItems.push(listItem)
|
||||
}
|
||||
calculateVisbleListItems()
|
||||
isInitialized = true
|
||||
thisObject.isVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
function turnOff () {
|
||||
thisObject.isVisible = false
|
||||
}
|
||||
|
||||
function onMouseOver (event) {
|
||||
isMouseOver = true
|
||||
}
|
||||
@@ -129,7 +136,7 @@ function newListView () {
|
||||
}
|
||||
|
||||
function calculateVisbleListItems () {
|
||||
let availableSlots = posibleVisibleListItems
|
||||
let availableSlots = Math.trunc(posibleVisibleListItems)
|
||||
|
||||
if (firstVisibleListItem < 1) { firstVisibleListItem = 1 }
|
||||
if (firstVisibleListItem > (thisObject.listItems.length - availableSlots + 1)) { firstVisibleListItem = thisObject.listItems.length - availableSlots + 1 }
|
||||
@@ -150,17 +157,9 @@ function newListView () {
|
||||
}
|
||||
|
||||
function getContainer (point, purpose) {
|
||||
if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return }
|
||||
if (isInitialized === false || thisObject.isVisible === false) { return }
|
||||
let container
|
||||
|
||||
if (isMouseOver === true && purpose !== GET_CONTAINER_PURPOSE.MOUSE_OVER) {
|
||||
container = thisObject.upDownButton.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
|
||||
container = thisObject.leftRightButton.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
}
|
||||
|
||||
/* First we check if thisObject point is inside thisObject space. */
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
/* Now we see which is the inner most container that has it */
|
||||
@@ -168,32 +167,13 @@ function newListView () {
|
||||
container = visibleListItems[i].getContainer(point)
|
||||
|
||||
if (container !== undefined) {
|
||||
let checkPoint = {
|
||||
x: point.x,
|
||||
y: point.y
|
||||
}
|
||||
|
||||
checkPoint = thisObject.fitFunction(checkPoint)
|
||||
|
||||
if (point.x === checkPoint.x && point.y === checkPoint.y) {
|
||||
if (purpose !== GET_CONTAINER_PURPOSE.MOUSE_OVER) {
|
||||
return container
|
||||
}
|
||||
if (container.isForThisPurpose(purpose) === true) {
|
||||
return container
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The point does not belong to any inner container, so we return the current container. */
|
||||
let checkPoint = {
|
||||
x: point.x,
|
||||
y: point.y
|
||||
}
|
||||
|
||||
checkPoint = thisObject.fitFunction(checkPoint)
|
||||
|
||||
if (point.x === checkPoint.x && point.y === checkPoint.y) {
|
||||
return thisObject.container
|
||||
}
|
||||
return thisObject.container
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,13 +185,14 @@ function newListView () {
|
||||
}
|
||||
|
||||
function physics () {
|
||||
if (isInitialized === false || thisObject.isVisible === false) { return }
|
||||
if (isInitialized === false) { return }
|
||||
if (thisObject.isVisible === false) { return }
|
||||
childrenPhysics()
|
||||
}
|
||||
|
||||
function draw () {
|
||||
if (isInitialized === false || thisObject.visible === false) { return }
|
||||
if (isInitialized === false || thisObject.isVisible === false) { return }
|
||||
|
||||
drawBackground()
|
||||
drawChildren()
|
||||
@@ -219,9 +200,11 @@ function newListView () {
|
||||
}
|
||||
|
||||
function drawChildren () {
|
||||
for (let i = 0; i < thisObject.listItems.length; i++) {
|
||||
let listItem = thisObject.listItems[i]
|
||||
listItem.draw()
|
||||
for (let i = 0; i < visibleListItems.length; i++) {
|
||||
let listItem = visibleListItems[i]
|
||||
if (listItem !== undefined) {
|
||||
listItem.draw()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ function newSidePanelTab () {
|
||||
thisObject.container.eventHandler.raiseEvent('opening')
|
||||
} else {
|
||||
animation = 'closing'
|
||||
thisObject.container.eventHandler.raiseEvent('closing')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +79,7 @@ function newSidePanelTab () {
|
||||
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON + xOffset
|
||||
thisObject.container.parentContainer.status = 'visible'
|
||||
thisObject.pointerDirection = 'right'
|
||||
thisObject.container.eventHandler.raiseEvent('opened')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +92,7 @@ function newSidePanelTab () {
|
||||
thisObject.container.parentContainer.frame.position.x = ORIGINAL_PARENT_POSITON
|
||||
thisObject.container.parentContainer.status = 'hidden'
|
||||
thisObject.pointerDirection = 'left'
|
||||
thisObject.container.eventHandler.raiseEvent('closed')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,4 +222,3 @@ function newSidePanelTab () {
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -25,6 +25,7 @@ function newSideSpace () {
|
||||
resize()
|
||||
|
||||
let openingEventSubscriptionId
|
||||
let closedEventSubscriptionId
|
||||
let browserResizedEventSubscriptionId
|
||||
return thisObject
|
||||
|
||||
@@ -42,13 +43,15 @@ function newSideSpace () {
|
||||
function finalize () {
|
||||
canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
|
||||
thisObject.sidePanelTab.container.eventHandler.stopListening(openingEventSubscriptionId)
|
||||
thisObject.sidePanelTab.container.eventHandler.stopListening(closedEventSubscriptionId)
|
||||
}
|
||||
|
||||
function initializeListView () {
|
||||
listView = newListView()
|
||||
listView.initialize()
|
||||
listView.container.connectToParent(thisObject.container, false, false)
|
||||
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', listView.reload)
|
||||
openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', listView.turnOn)
|
||||
closedEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closed', listView.turnOff)
|
||||
}
|
||||
|
||||
function resize () {
|
||||
|
||||
Reference in new issue
Block a user