C# WPF toggle button drag, swipe right-left - c#

I want to make a custom button. It's like toggle but has 3 functions. As seen in the first picture, the "PICK" circle button appears in the middle. When I swipe the circle to the right or left, it should move towards the direction I swiped and hold until the end. How can I do that?
Thanks.

Related

(Unity) Trying to trigger multiple objects by holding down the mouse with OnMouseDown

need a little help with something. My scene consists of 4 spheres, and what I'm trying to achieve is when you click on one sphere, the colour of the sphere changes, and as you drag the mouse (while it's still held down) onto the other spheres, the other spheres change colour too. So far what I've managed to do is change the colour of the sphere when it's clicked, but I'm not able to change the colour of the other spheres when I drag the mouse onto them. I assume this is obviously because the code is only run when the mouse is first clicked. Is there a way to change this so a sphere changes colour when the mouse is clicked and dragged onto it? I've tried playing around with OnMouseDrag but with no success. Here's a link to a video of what I've got so far and what I'm trying to go for: https://youtu.be/KOBqnH0je6A
(All spheres have the same script attached) And here's my code:
`
public GameObject sphere;
public Material material;
void OnMouseDown()
{
sphere.GetComponent<MeshRenderer>().material = material;
}
`
Managed to achieve what I wanted by using a static boolean. The boolean is set to true when the mouse button is clicked, then an OnMouseEnter function changes the material of the object if the boolean is true. Then the boolean is set to false when the mouse is let go of!

Drag map with limits

I have a map (2d) which is about 5 times the size of the screen area. I can touch drag the map. However the user must only be able to drag it as far as the map is still showing. So the empty area outside map isn't showing.
So my question is: which of the two methods are best:
1) have colliders at the side of the screen and then put colliders on each side of the map. Then checking for collision and if so move the map so its collider does not touch the screen collider.
Or
2) check for the position of the map (i have an adjustable screen size according to device) and then stop the drag if it gets dragged further than visibility of screen. Using coordinates and math.
Will it take up more space (the ios/android) file if I use solution 1?
Thanks.

Samsung Gear VR - create Menus

how can I create Menu in my application , I use canvas , but Gear VR Camera dosent see it .
is there way , to use button in gear application
3d text appear but not canvas text
Never use screen space ui with VR, switch to world space and either place it somewhere in the scene (as a "real" object) or parent it to the camera so it is always in the center of the viewport.
ChanibaL is right, canvas can not be used in screen space.
Last time, when I design a menu in vr. I add sphere out of the camera, with a full black color. And put the ui buttons inner the sphere as a menu.
I think this may help for you.
More about UI design in vr, I advice to read this post UI for VR

Zoom a custom user control on mouse move event

I am trying to zoom a custom usercontrol which contains a polygon, say paralellogram, which I created with the help of four points with X,Y coordinate but, when I try to zoom it on mouse move event, it stays at the same position and doesn't work out. Any suggestions ?

Form off Screen - Cursor off Form Area

Following this post
I've thought a "simple" solution.
My goal is to prevent mouse movement when my winForm has reached the allowed coordinates.
For instance, if offScreen is for maxX (right border), user will can move mouse in all direction except for left to right.
Is there some event (native too) to accomplish that?

Categories

Resources