Clickable Maps In Container - codenameone

I have an Image (map of Africa). I want each countries to be clickable such that a new form is opened on tap. Is this possible with CN1?
I have checked the cn1libs portal and can't find any library that does this.
I thank you

Create two maps. One would look like you want the map to look on the screen. The other would use a different color for every country.
Use a pointer listener or pointerReleased on a focusable component to track user taps on the map so you'd have an X/Y coordinate.
Use getRGB() to get the RGB colors of the pixels in the color map, then get the color at rgb[x + y * imageWidth]
This color represents the country that was picked and you can map to that using a switch statement.

Related

Disable scrolling of a PeerComponent (GoogleMap)

Is it possible to disable the X and Y scrolling of a GoogleMap inside a Codename One?
I'm referring to a map created using the cn1lib described here: https://www.codenameone.com/blog/new-improved-native-google-maps.html
If the map is scrollable, then I cannot insert more than one map in a Form, otherwise the contentPane scrolling and map scrolling conflict. If the maps can be not scrollable, then I can insert more maps in the same Form without scrolling issues.
I know that I can use static maps (that are images), but I need that pinch-to-zoom and pin locators action listeners work.
Thank you
To expand on Steves comment. There's no support for this in the peer component wrapping. We assume most peers are scrollable within as mixing scrolling and native peers with produce a bad experience. E.g. panning the map instead of scrolling or potential artifacts when the map and title area draw on top of each other when your page is scrolled down.
I would suggest you take a different route for this use case. Use a static image and when a user taps the map open a map in the bottom part of the screen as a dialog or as a separate form to provide the full map UX.

React: Select body part from image

I want to build a website with React on which you can select different parts of a body. I would like to ask for your opinion what would be the best possibility for that? How can I highlight different parts of the body and make them clickable?
I would image a screen like this where I can press e.g. an arm, leg, head etc.:
Thank you for your help!
You will need two images.
Original colour body shape ( let's call this passive state ).
Active colour body shape.
Create a grid of rectangles on top of passive state image according to body parts, slice the active body shape image and put in rectangles as background images and set the image size to 0. On hover just set the size of the image to the original value.

How to remove neighboring country names from the map?

So, I have been working to style my map. But, stepped on a hitch back, such as to how to remove the neighbouring country name. So, my focus of work is only on INDIA. Also, how to not let map zoom out after INDIA boundaries because it now zooms out all the way.
For refrence see img
home
Google Maps has a styling wizard where it's easy to customize your map, I found the administrative.country property and set visibility off in styler.
https://mapstyle.withgoogle.com/
Above link will help.

codename one native google map show in small rectangle

I am using Mapcontainer to display native maps on android device. the map container is added to a form which has a text field and a button. When I run this on device the map loads in a very small rectangle as shown in the below image link. How can I increase the map size?
Image link : http://i.stack.imgur.com/y9eBv.jpg
This is caused by placing the map in a form with FlowLayout. Place the map container at the center of a BorderLayout form.
change the form layout to BorderLayout
Move the button and the textfield inside a new container, place this container at the North position of the form.
Place the map container at the center of the form

Navigate through big image

I have a big image with coordinate points.
I need to navigate through these points by pressing onscreen buttons.
Only a part of image is seen on the screen at once (shows your location).
By pressing arrow button the view moves to the next part of the same image.
This example looks good.
Please, suggest any way to implement this functionality in Codename One App
Thank You.
You can use the Map component but you can place any image as a label icon within a scrollable container and just let the user use the touch/keys to scroll.

Resources