Using pen to control scrollviewer and disable touch - microsoft-metro

For a page with a scrollviewer - using the hand gesture allows the user to scroll up and down and across or whatever. Using a pen doesn't do anything.
The requirement is to have a button to reverse the functionality of pen and touch.
If this button is pushed the touch can draw ink strokes on a canvas and the pen cannot. This works.
I'm not entirely sure how to proceed with the situations:
pen to be "gesture" to scroll page instead of touch.
hand to draw ink stroke on a canvas that is within a scrollviewer.
Is there a method or attribute that i can set that makes the pen/hand accept gestures?
thanks.

So I found a suggestion (can't remember where) ... that i should disable the zooming and scrolling. When that was set I called the method to allow for inking. Not entirely sure if that's the correct way of doing it but through various testing...it worked.

Related

Dealing with Popup in Corona game engine

I have a screen in Corona to display a puzzle, and once user guess the correct answer, I'm going to display a simple pop up on the screen to do the congratulation a long with close button to dismiss the popup, now I need for a simple work around to disable any control or behaviour on the original screen while displaying the popup, how can I do that?
I think you need to do this by stop or pause transitions, timers and animations etc. before you go to scene with pop up.
You can add transparent rectangle from transparent image file (not just rectangle, as it will not be touchable).
Size of this rectangle must be the size of all screen.
Position of rectangle - under your popup (or better make it as part of your popup).
Add listeners to this rectangle on touch and tap that will just return false - so it will prevent any clicks under it.
That will save you from pausing / disabling buttons, that you don't want to disable/pause.

Keep touchZoom centered?

I am using Leaflet in a mobile app and want to get rid of the two zooming buttons in the top corner, but I need the exact same effect (zooming without the possibility of panning around with it) but using a pinching gesture. Alas, the default pinching gesture does not keep the view centred!
I don't know why, but keeping the zoom centred when using the mousewheel or doubleclick are available options for the map object:
If passed 'center', double-click zoom will zoom to the center of the view regardless of where the mouse was.
If passed 'center', it will zoom to the center of the view regardless of where the mouse was.
But not for touchZoom, I tried. maybe the nice people at Leaflet thought the effect doesn't "feel" nice, but I really wish I could try it nonetheless and judge it by myself.
Anyone knows how to get a similar effect? I don't really want to end up calling setView() at every "zoom" event call, if that even was an option...
Found out that I could use the maxBounds option. If you set both corners on a single point (the one you'd use for setView, for example), the map won't be able to pan away from it.

How to add overlays designed by user on button click in a map

I am interested in adding an option to my GIS Map application, the ability to draw Polygon, circle, polyroutes overlays for the user to search data within.The problem is that I've read and tested codes of how to draw an overlay, but they are always static.I want it to be dynamic, with dynamic center and points (or radius) set by the user on click.A mystery for me.(I'm a beginner in iPhone programming, this is my first app.)And I'm not using and don't want to use things like ArcGIS API for iPhone.I would appreciate any help.
To let the user "draw" an arbitrary polygon on the map, one approach is to use draggable annotations that represent the corners of the polygon. Provide an "Add Corner" button and some kind of Remove Corner button on each annotation.
See my answer to User creating a box on MKMapView for some more details. On that question though, the OP actually ended up using another solution described in the comments which would work well if the polygons are always rectangles.
For implementing a button in an annotation view (if you want a "Remove Corner" button on the annotations), see my answer to How to get click event from a button added over MKAnnotationView.
Once you a have a polygon or other overlay on the map, dragging it by direct touches may only be possible by adding a gesture recognizer to the map (with its own scrolling turned off) and using a custom MKOverlay and MKOverlayView that allow coordinate changes. Adding a gesture recognizer directly to an MKOverlayView doesn't seem to work and the built-in overlay classes don't allow changes to coordinates.
An alternative to moving by direct touches is putting some controls on the side (Up/Down/Left/Right/etc buttons) that modify the custom overlay.
The Apple sample app Breadcrumb gives an example of a custom overlay/view for a path. In WWDC 2010, the sample app LocationReminders gives an example of a custom overlay/view for a circle that can move and resize.
Finally, when you do a search for businesses, you could use the overlay's boundingMapRect (which is always a rectangle regardless of the overlay's shape) as the bounding box for the initial search and then check if the coordinate of each business found is in the overlay's actual shape using the answer to How to determine if an annotation is inside of MKPolygonView (iOS).

switching images with animation

I'd like to have a static background image (let's imagine a model in underwear), where several images are placed in layers in front of the background. Each image in front can be switched out, from the left or right, with some animation.
So our model might start with a panama hat on her head. A gesture replaces it with a porkpie hat, another gesture places a toque. A dress on her body switches to a pant suit, then mechanic overalls. Cowboy boots to sandals to galoshes, and etc.
It seems there are many ways to do this. I could use UIScrollView, with paging enabled. There is Core Animation, with CALayers on top of the background image. Even simple UIImageViews with swipe gestures enabled, tracking coordinates of the user's finger.
Does one of these techniques stand out as being better than the others in this case? Or does it seem to you readers that each could work as well as the others?
I'd say if you want a prebuild solution try OpenFlow (I'm not affiliated, just a user)
http://apparentlogic.com/openflow/
Otherwise, maybe just a UIScrollView with paging enabled would do the trick?

How to extend a button touch area?

I have an arrow button that I want to keep small but I want the touch area around it to be bigger.
I used the answer from the post Here but it made my button larger.
The problem is that the picture of the button is larger than the size it is presented in. But I thought there must be a way to do it without editing it or adding a transparent button.
Use a custom button with an image with mode "center"(which means that it doesn't resize with the button size and stays always in the center). Then you can make the button as big as you want and the button image always stays in the middle with the same size.
You should be able to do it by extending the button class and overriding the hitTest method. In your version of this method you can expand the area checked to include a buffer area and return the button if the touch happens within it.
A transparent button behind this button would also work and just point that to the method... I suppose you could go about this multiple ways. One should prefer the option that is simplest with the least overhead.