Read the Coordinates in perspective

i want to read the coordinates on clicking anywhere on the Screen. For that i have two labels one for X coordinate and other for Y coordinate.
once got the coordinates value i want to move the circle for the particular location as per coordinates value we received.
this requirement is in Perspective.

You should use the canvas component that covers the whole clickable screen.
There you can put on onmouseclick event on which contains coordinates, and its also easy to put a component in it with specific coordinates

Thanks for replying @victordcq, could you have some python code for that..

do you want them to be draggable or just onclick?


	yourViewPath =  "test" #change this to your view of th cricle thingy
	baseInstance = {
	  "position": "absolute",
	  "top": event.clientY,
	  "left": event.clientX,
	  "bottom": "auto",
	  "right": "auto",
	  "zIndex": "auto",
	  "width": "auto",
	  "height": "auto",
	  "viewPath": yourViewPath,
	  "viewParams": {},
	  "style": {
	    "classes": ""
	  }
	}
	self.props.instances = [baseInstance]

put this in the onclick

just on clicking.

than the edit i just did to the post above should get you started :slight_smile:

thanks for the instance reply @victordcq i am new on ignition.
let me try and will let you know.

is this script i have to run on ROOT or Button event?
i am confused.

Select the canvas component, right click, then select configure events.

thanks @dkhayes117

Thanks for supporting me @victordcq ,bwlow is the modified code.
yourViewPath = "Button" #change this to your view of th cricle thingy
baseInstance = {
"position": "absolute",
"top": event.clientY,
"left": event.clientX,
"bottom": "auto",
"right": "auto",
"zIndex": "auto",
"width": "auto",
"height": "auto",
"viewPath": yourViewPath,
"viewParams": {},
"style": {
"classes": ""
}
}
self.props.instances = [baseInstance]


i have attached screen shot my screen .

yourViewPath needs to be a view,

If you did not create a view named Button, this will not do anything.
image

in this new view, you can put your button or the circle thing or whatever

i have created new view (i.e test) after that dragged view canvas in that and added button on the view canvas.
your script added on the view canvas .
but same error .

The main view has the canvas with script, the test view has something you want to show at the position that is clicked in the main view...

  • mainview

    • canvas with script to viewPath = test
  • test

1 Like

thank you @victordcq for your Instance support.
i appreciated you work.
because of you i got the solution.

1 Like