WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-16-2005, 10:48 AM
steve steve is offline
Member
 
Join Date: Jun 2005
Location: USA
Posts: 4
Mouse problem

Hi,
trying to develop a different navigation for vizard, I’m having three problems with the mouse commands:

1. When I bring the mouse up, at a certain position close to the top the program throws it down (MOUSEMOVE_EVENT), the same happens at the bottom, the mouse gets pushed up at a certain positon.
2. Also, when I click the ‘tabb’ and the left mouse-button (in the program below) and release the mouse and tabb again, the view still changes and moves in, also I did not program that.
3. How could I implement a keyboard-command that get’s only triggered if the user presses shift+ctrl (this question is not very important, so if it is complicated I just take another key).

Steve




Code:
view = viz.get(viz.MAIN_VIEWPOINT)
view.translate(2.50, 1.01, -0.25)#1.3269580602645874, 1.013837456703186, -0.55598777532577515)
view.rotate(-90,0,0)


mouseIsMovingUp=1
pointIsMovingRight=1
pointIsMovingUp=1

oldMousePos=0
currentMousePosX =0


def mykeyboard(whichKey):
	print 'This key was pressed: ', whichKey
	if whichKey == viz.KEY_CONTROL_L:
		viz.mouse(viz.ON)
	if whichKey == '65289':
		print'tabb',pointIsMovingUp
		if viz.buttonstate()==1:
			if pointIsMovingUp==1:
				viz.mouse(viz.OFF)
				print 'pointIsMovingUP==1'
				#print 'viz.get(viz.MAIN_VIEWPOINT):', view.get(viz.HEAD_POS)
				view.translate(view.get(viz.HEAD_POS)[0],view.get(viz.HEAD_POS)[1]+.05,view.get(viz.HEAD_POS)[2])
				return
			if pointIsMovingUp==0:
				viz.mouse(viz.OFF)
				print 'pointIsMovingUP==1'
				#print 'viz.get(viz.MAIN_VIEWPOINT):', view.get(viz.HEAD_POS)
				view.translate(view.get(viz.HEAD_POS)[0],view.get(viz.HEAD_POS)[1]-.05,view.get(viz.HEAD_POS)[2])
				return

viz.callback(viz.KEYBOARD_EVENT, mykeyboard)


def mymousemove(horz, vert):
	global mouseIsMovingUp,pointIsMovingRight,pointIsMovingUp, oldMousePos,currentMousePosX
	
	if vert>0:
		mouseIsMovingUp=1
		pointIsMovingUp=1
		print 'up'
		return
	if vert<0:
		mouseIsMovingUp=0
		pointIsMovingUp=0
		print 'down',pointIsMovingUp
		return


	#print 'horz, pos',horz, pos
	if horz>currentMousePosX:
		pointIsMovingRight=1
		#print 'in right1'
	if horz<currentMousePosX:
		pointIsMovingRight=0
		#print 'in right0'
	
	oldMousePos=currentMousePosX
	currentMousePosX = viz.mousepos()[0]
	print 'oldMousePos',oldMousePos,currentMousePosX


	#print 'My mouse moved to: ', horz, vert
viz.callback(viz.MOUSEMOVE_EVENT, mymousemove)



#def mymouse(whichButton):
#	if whichButton == viz.MOUSEBUTTON_LEFT:
#		#viz.mouse(viz.ON)

#viz.callback(viz.MOUSEUP_EVENT, mymouse)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:32 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC