We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I am trying to reproduce this command ( http://forum.processing.org/one/topic/how-to-avoid-peasycam-rotations-when-using-controlp5-sliders.html ) to avoid rotation from control peasyCam when the mouse is over a controlP5 group.
My problem is I can't find a way to use isMouseOver() correctly as it always return true...
I reproduced a minimal version of my code :
import controlP5.*;
ControlP5 cp5;
Accordion panelControl;
void setup() {
size(400, 400);
initialiseGUI();
}
void draw() {
background(0);
if (panelControl.isMouseOver()) {
println(frameCount, true);
}
else {
println(frameCount, false);
}
}
void initialiseGUI() {
cp5 = new ControlP5(this);
Group InitGroup = cp5.addGroup("Initialisation")
.setBackgroundHeight(100)
;
cp5.addSlider("slider")
.setPosition(20, 20)
.setSize(100, 10)
.setRange(0, 50)
.moveTo(InitGroup)
;
panelControl = cp5.addAccordion("acc")
.setWidth(220)
.addItem(InitGroup)
;
}
what am i doing wrong ?
thanks for your time!
Answers
Hi, a quick fix is to change
if (panelControl.isMouseOver()) {
toif (cp5.isMouseOver()) {
which returns true whenever the mouse is on top of a controller.
it works perfectly! many thanks!