Mouse over working
This commit is contained in:
1 parent
255c1dfc9e
commit
599e48062f
4 files changed
+31
-21
No files matched your search
@@ -854,7 +854,7 @@ function newCanvas () {
|
||||
|
||||
/* We check if the mouse is over an element of the Designe Space / */
|
||||
if (thisObject.sideSpace !== undefined) {
|
||||
container = thisObject.sideSpace.getContainer(point)
|
||||
container = thisObject.sideSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
|
||||
|
||||
if (container !== undefined && container.detectMouseOver === true) {
|
||||
containerFound()
|
||||
|
||||
+27
-2
@@ -25,9 +25,16 @@ function newListItem () {
|
||||
let name
|
||||
let type
|
||||
|
||||
let onMouseOverEventSubscriptionId
|
||||
let onMouseNotOverEventSubscriptionId
|
||||
|
||||
let isMouseOver = false
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
thisObject.container.eventHandler.stopListening(onMouseOverEventSubscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(onMouseNotOverEventSubscriptionId)
|
||||
|
||||
thisObject.container.finalize()
|
||||
thisObject.container = undefined
|
||||
thisObject.fitFunction = undefined
|
||||
@@ -36,6 +43,9 @@ function newListItem () {
|
||||
function initialize (pName, pType) {
|
||||
name = pName
|
||||
type = pType
|
||||
|
||||
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
|
||||
onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
|
||||
}
|
||||
|
||||
function getContainer (point) {
|
||||
@@ -44,6 +54,14 @@ function newListItem () {
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseOver (event) {
|
||||
isMouseOver = true
|
||||
}
|
||||
|
||||
function onMouseNotOver () {
|
||||
isMouseOver = false
|
||||
}
|
||||
|
||||
function onMouseClick (event) {
|
||||
|
||||
}
|
||||
@@ -55,6 +73,7 @@ function newListItem () {
|
||||
function draw () {
|
||||
let icon = canvas.designSpace.iconByUiObjectType.get(type)
|
||||
let backgroundColor = UI_COLOR.BLACK
|
||||
let labelColor
|
||||
|
||||
const RED_LINE_HIGHT = 4
|
||||
const OPACITY = 1
|
||||
@@ -69,10 +88,16 @@ function newListItem () {
|
||||
opacity: OPACITY
|
||||
}
|
||||
|
||||
if (isMouseOver === false) {
|
||||
labelColor = UI_COLOR.WHITE
|
||||
} else {
|
||||
labelColor = UI_COLOR.TITANIUM_YELLOW
|
||||
}
|
||||
|
||||
roundedCornersBackground(params)
|
||||
|
||||
drawLabel(name, 1 / 2, 3.0 / 10, -5, 0, 15, thisObject.container)
|
||||
drawLabel(type, 1 / 2, 7.2 / 10, -5, 0, 15, thisObject.container)
|
||||
drawLabel(name, 1 / 2, 3.0 / 10, -5, 0, 15, thisObject.container, labelColor)
|
||||
drawLabel(type, 1 / 2, 7.2 / 10, -5, 0, 15, thisObject.container, labelColor)
|
||||
drawIcon(icon, 1 / 2, 1 / 2, 0, 0, 80, thisObject.container)
|
||||
}
|
||||
}
|
||||
@@ -41,16 +41,11 @@ function newListView () {
|
||||
let itemSeparation
|
||||
|
||||
let onMouseWheelEventSuscriptionId
|
||||
let onMouseOverEventSubscriptionId
|
||||
let onMouseNotOverEventSubscriptionId
|
||||
|
||||
let isMouseOver
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
thisObject.container.eventHandler.stopListening(onMouseWheelEventSuscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(onMouseOverEventSubscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(onMouseNotOverEventSubscriptionId)
|
||||
|
||||
listItemsMap = undefined
|
||||
visibleListItems = undefined
|
||||
@@ -75,8 +70,6 @@ function newListView () {
|
||||
thisObject.container.frame.position = position
|
||||
|
||||
onMouseWheelEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
|
||||
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
|
||||
onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
|
||||
|
||||
resize()
|
||||
turnOn()
|
||||
@@ -125,14 +118,6 @@ function newListView () {
|
||||
thisObject.isVisible = false
|
||||
}
|
||||
|
||||
function onMouseOver (event) {
|
||||
isMouseOver = true
|
||||
}
|
||||
|
||||
function onMouseNotOver () {
|
||||
isMouseOver = false
|
||||
}
|
||||
|
||||
function onMouseWheel (event) {
|
||||
delta = event.wheelDelta
|
||||
if (delta > 0) {
|
||||
|
||||
+3
-3
@@ -69,13 +69,13 @@ function newSideSpace () {
|
||||
}
|
||||
}
|
||||
|
||||
function getContainer (point) {
|
||||
function getContainer (point, purpose) {
|
||||
let container
|
||||
|
||||
container = thisObject.sidePanelTab.getContainer(point)
|
||||
container = thisObject.sidePanelTab.getContainer(point, purpose)
|
||||
if (container !== undefined) { return container }
|
||||
|
||||
container = listView.getContainer(point)
|
||||
container = listView.getContainer(point, purpose)
|
||||
if (container !== undefined) { return container }
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
|
||||
Reference in new issue
Block a user