/////////////////////////
//ColorPicker and colorpicker button
PImage colPick = pa.loadImage(imagesPath + "colorcircle.png");
// final MTColorPicker colorWidget = new MTColorPicker(0, pa.height-colPick.height, colPick, pa);
final MTColorPicker colorWidget = new MTColorPicker(0, 0, colPick, pa);
colorWidget.translate(new Vector3D(0f, 135,0));
colorWidget.setStrokeColor(new MTColor(0,0,0));
colorWidget.addGestureListener(DragProcessor.class, new IGestureEventListener() {
public boolean processGestureEvent(MTGestureEvent ge) {
if (ge.getId()== MTGestureEvent.GESTURE_ENDED){
if (colorWidget.isVisible()){
colorWidget.setVisible(false);
}
}else{
drawingScene.setBrushColor(colorWidget.getSelectedColor());
}
return false;
}
});
frame.addChild(colorWidget);
colorWidget.setVisible(false);
PImage colPickIcon = pa.loadImage(imagesPath + "ColorPickerIcon.png");
MTImageButton colPickButton = new MTImageButton(colPickIcon, pa);
frame.addChild(colPickButton);
colPickButton.translate(new Vector3D(-50f, 195,0));
colPickButton.setNoStroke(true);
colPickButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae) {
switch (ae.getID()) {
case TapEvent.BUTTON_CLICKED:{
if (colorWidget.isVisible()){
colorWidget.setVisible(false);
}else{
colorWidget.setVisible(true);
colorWidget.sendToFront();
}
}break;
default:
break;
}