What are the slots should I use?

Have jReality programming problems or questions? Post them here.
Post Reply
cznlzq
Posts: 17
Joined: Mon 5. Mar 2012, 22:55

What are the slots should I use?

Post by cznlzq » Tue 29. May 2012, 19:25

Hi,

I want to use the Alt + MouseRightButtonClick in my customized tool.

What kinds of slots should I use?

Thank you.

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: What are the slots should I use?

Post by Andre » Wed 30. May 2012, 16:05

Unfortunately, there is no Inputslot for ALT+Mouseclick, but you can already use SHIFT instead. Your tool have to inherit from AbstactTool.

I guess my old Class would help you:

Code: Select all


import de.jreality.scene.SceneGraphComponent;
import de.jreality.scene.tool.AbstractTool;
import de.jreality.scene.tool.InputSlot;
import de.jreality.scene.tool.ToolContext;

/**
 * @author heydt
 *
 */
public class RemoveTranslationTool extends AbstractTool{
	private static InputSlot SHIFT_LEFT_BUTTON = InputSlot.SHIFT_LEFT_BUTTON;
	private SubGeometry sG;
	
	public RemoveTranslationTool(final SubGeometry sG) {
		super (SHIFT_LEFT_BUTTON);
		this.sG = sG;
	}
	
	@Override
	public void activate(ToolContext tc) {
		System.out.println("shiftleftbutton");
		int idx = tc.getRootToToolComponent().getLength()-2;
		SceneGraphComponent curr = (SceneGraphComponent) tc.getRootToToolComponent().get(idx);
		sG.remove(curr);
	}
	
	@Override
	public void deactivate(ToolContext tc) {
		System.out.println("No longer active. Deactivated by "+tc.getSource());
	}
	
	@Override
	public void perform(ToolContext tc) {
		
	}
}

cznlzq
Posts: 17
Joined: Mon 5. Mar 2012, 22:55

Re: What are the slots should I use?

Post by cznlzq » Thu 31. May 2012, 20:28

Thanks for the reply.

It looks like the SHIFT is there, adding the ALT should be trivial.

I read the jReality Wiki a little bit, I think I have to add the mapping to the toolconfig-split.xml.

But it looks like it's not the whole story, I just don't know what else I should do to make it work.

Still, is it possible for me to add a inputslot in the tool system so that
I can use the ALT+Mouseclick in my tool?

Thank you.
Andre wrote:Unfortunately, there is no Inputslot for ALT+Mouseclick, but you can already use SHIFT instead. Your tool have to inherit from AbstactTool.

I guess my old Class would help you:

Code: Select all


import de.jreality.scene.SceneGraphComponent;
import de.jreality.scene.tool.AbstractTool;
import de.jreality.scene.tool.InputSlot;
import de.jreality.scene.tool.ToolContext;

/**
 * @author heydt
 *
 */
public class RemoveTranslationTool extends AbstractTool{
	private static InputSlot SHIFT_LEFT_BUTTON = InputSlot.SHIFT_LEFT_BUTTON;
	private SubGeometry sG;
	
	public RemoveTranslationTool(final SubGeometry sG) {
		super (SHIFT_LEFT_BUTTON);
		this.sG = sG;
	}
	
	@Override
	public void activate(ToolContext tc) {
		System.out.println("shiftleftbutton");
		int idx = tc.getRootToToolComponent().getLength()-2;
		SceneGraphComponent curr = (SceneGraphComponent) tc.getRootToToolComponent().get(idx);
		sG.remove(curr);
	}
	
	@Override
	public void deactivate(ToolContext tc) {
		System.out.println("No longer active. Deactivated by "+tc.getSource());
	}
	
	@Override
	public void perform(ToolContext tc) {
		
	}
}

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: What are the slots should I use?

Post by Andre » Fri 1. Jun 2012, 08:40

I'll have a deeper look at this next week.

best
Andre

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: What are the slots should I use?

Post by Andre » Wed 6. Jun 2012, 18:37

I just tried to expand the inputSlots with an tertiary action. I've expanded the tool-config, too.

It wasn't possible to enable either CONTROL nor ALT. I'll talk to Steffen tomorrow, who knows more about the toolsystem.

best
Andre

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: What are the slots should I use?

Post by Andre » Thu 7. Jun 2012, 17:28

It should now be possible to use control/alt + mouse. I've just tested it with my linux computer and there I'm not able to use it with alt+mouseclick, because the systemdefault for the ALT+Mouseclick overwrites the jReality default. Alt+Mouseclick is often the standard for moving a window around.

So the "standard" implementation for a coustumized mouseclick tool is now CONTROL. If you want to change it you can simply edit the toolconfig-mouse-keyboard.xml at de.jreality.toolsystem.config.chunks
<!-- mapping src="AltMeta" target="Tertiary" / -->
<mapping src="Meta" target="Tertiary" />
Meta = CONTROL
AltMeta = ALT

best regards
Andre

Post Reply