From b024d110d75de02c5978d1062b20bd11b4ae5e5f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 30 Apr 2020 19:23:24 +0200 Subject: [PATCH] Update Picker.js --- FloatingSpace/Picker.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/Picker.js b/FloatingSpace/Picker.js index 9cfc32b67..703e193c1 100644 --- a/FloatingSpace/Picker.js +++ b/FloatingSpace/Picker.js @@ -21,12 +21,14 @@ function newPicker () { thisObject.container.isClickeable = false thisObject.container.isDraggeable = false thisObject.container.isWheelable = true + thisObject.container.detectMouseOver = true thisObject.container.frame.radius = 0 thisObject.container.frame.position.x = 0 thisObject.container.frame.position.y = 0 thisObject.container.frame.width = 250 thisObject.container.frame.height = 120 + let isMouseOver let optionsList let parent let current @@ -35,11 +37,15 @@ function newPicker () { let selected = 0 let lastSelected = 0 let onMouseWheelEventSubscriptionId + let onMouseOverEventSubscriptionId + let onMouseNotOverEventSubscriptionId return thisObject function finalize () { thisObject.container.eventHandler.stopListening(onMouseWheelEventSubscriptionId) + thisObject.container.eventHandler.stopListening(onMouseOverEventSubscriptionId) + thisObject.container.eventHandler.stopListening(onMouseNotOverEventSubscriptionId) thisObject.container.finalize() thisObject.container = undefined optionsList = undefined @@ -53,6 +59,16 @@ function newPicker () { parent = pParent propertyName = pPropertyName onMouseWheelEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel) + onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) + onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver) + } + + function onMouseOver (event) { + isMouseOver = true + } + + function onMouseNotOver () { + isMouseOver = false } function getSelected () { @@ -195,7 +211,10 @@ function newPicker () { opacity = 0.4 break } - drawLabel(label, 1 / 2, i / VISIBLE_LABELS, 0, 0, fontSize, thisObject.container, fontColor, undefined, undefined, opacity) + + if (i === 2 || isMouseOver === true) { + drawLabel(label, 1 / 2, i / VISIBLE_LABELS, 0, 0, fontSize, thisObject.container, fontColor, undefined, undefined, opacity) + } } } }