Mouse reading coordinates - wpf-controls

I have a panorama page in Landscape mode and a canvas inside it .
I am having multiple images on the canvas , I am handling double click on each canvas element based on the co ordinates (position ) of the mouse click event .
When I click on the screen , the coordinates are staring from the bottom left position (0,0), as it corresponds to Portrait page .
Is there any I can change this , so that it will be adjusted to the Landscape mode .

Related

How can I create a logo in LaunchScreen.storyboard?

I have added an ImageView to my LaunchScreen.storyboard in Xcode 13.1 and I have selected my logo but I don't know what to do so that my logo is always in the center of the screen. What can I do so that my logo is always in the center of the screen?
Open LaunchScreen.Storyboard with Xcode .
Set constraints on the ImageViewto determine its position and size .
Enable the options to let it centers in horizontally and vertically .
Drag the square handle to the superview(Container) ,and make them Width/Height eqaul.
Select property menu and modify the Width/Height to make them proportional to superView .
Modify the multiplier to what you want(If the image is full with screen ,set it as 1) .
Save and exit Xcode .
Update
The default content mode is Aspect fit , change it to Scale To Fill.
Refer to
https://learn.microsoft.com/en-us/xamarin/ios/user-interface/designer/designer-auto-layout.

How do I create the center of TouchScreenButton texture in the center of the TouchScreenButton position along with it's shape?

So, if I create a button using TouchScreenButton and assign a texture to it, the texture will be displayed on the left bottom of the TouchScreenButton position (See image below)
The TouchScreenButton position is in the top left corner of the rectable
When I don't assign a texture and instead I create a sprite as the child node and assign a texture to it, it will display the texture in the center of TouchScreenButton.
But the shape is still follows what I have said earlier.
My question, How do I create the center of TouchScreenButton texture in the center of the TouchScreenButton position along with it's shape? I want the TouchScreenButton is in the middle of the TouchScreenButton texture.
Solution 1. Go to your Sprite node and in the inspector disable Centered property in the offset section. This way though you should keep sprite and shape sizes for centers of the area and the texture to match, coz now both the Sprite and Shape will be to the right bottom of the origin coordinates of the button.
Solution 2. Go to your TouchScreenButton node and in the inspector enable Shape Centered property in the main section. This way you will make both the shape and the sprite to be centered in the origin of the button.

reposition overlay after zoom on map

I am working with a map on which I put an overlay to highlight certain areas, now I want to zoom the map in and out and reposition the overlay so that it is still over the same region. The map is displayed in a JavaFX WebView and the overlay is a polygon that is drawn into a group that is in a pane on top of the WebView.
Now I am trying to calculate the correct position for the overlay, but I can't figure out how. Does someone have some experience there and maybe can point me into the right direction ?

NSDocument - setting a reasonable starting location for the window

I'm playing about with the most recent NSDocument in a Swift document-based-app. One thing that's a bit odd is that the starting location for a new window is near the bottom of the screen.
Playing with the Storyboard a bit, its not clear how to use the built-in settings to come up with a reasonable "near the top" selection - the setting moves up from the bottom, not down from the top, so the position would change depending on the screen size?
I assume there's a position mechanism I can hook, but it's not obvious in the shell code that's supplied. Any hints?
OS X coordinate system is flipped in contrast to iOS. So the 0,0 is the bottom left corner.
You can calculate the position of your window in similar manner (any screen size)
CGFloat width = NSWidth([self.window screen].frame);
CGFloat height = NSHeight([self.window screen].frame);
[self.window setFrame:NSMakeRect(100, height - 100, width, height) display:YES];
Most easiest is to set initial height to 900 and forget about it and enable window restoration -> this will cause to open the window where it previously was and this is where it user wants.
Select your window in Storyboard. And fill initial position coordinates

Drawing on canvas with python and tkinter

I am trying to display mouse position on timer. I use winfo_pointerxy(), here is part of the code from my_func():
curr_x, curr_y = mouseFrame.winfo_pointerxy()
curr_x = mouseFrame.canvasx(curr_x)
curr_y = mouseFrame.canvasy(curr_y)
mouseFrame.create_oval(curr_x, curr_y, curr_x + 5, curr_y + 5, fill='green')
start_btn.after(time_interval, my_func)
It seems like I use canvasx() wrong cause it still returns position counted from the left-up corner of the screen.
According to this tkinter reference (which I use constantly)
Because the canvas may be larger than the window, and equipped with
scrollbars to move the overall canvas around in the window, there are
two coordinate systems for each canvas:
The window coordinates of a point are relative to the top left
corner of the area on the display where the canvas appears.
The canvas coordinates of a point are relative to the top left
corner of the total canvas.
If your canvas is against the upper left corner of the window (display) and you have not scrolled the canvas, the two sets of coordinates should be the same.

Resources