How to move map after marker was selected - react-native

I want to create animation: after click on marker, center of map should move to that marker and verticaly to a fixed point from bottom (I have some semi-transparent views on top and bottom of a map and want always to see whole callout after marker was clicked). How to acheve that? I saw I can move map to region and to map coordinate, but is it possible to move to point on screen?

Related

Move view hiding its side in android

Moving a view I try to hide all parts of view that cross some vertical line, so view starts to loose its width to 0.
The image describes better what I want.
I mean not just shrink a width with scaleX but hide, because this command compresses the photo horizontally, and I need to hide it without distortion.
How can I do it?
On the image a photo started to move left with translationX hiding line by line left side of the photo during this movement. Also, the photo is not at left edge of screen - it's on the center
View has left(and x) attribute in its LayoutParams.
How can I dynamically set the position of view in Android?
When left attribute is negative, it is hidden under the parent view.
If you want an animation, here is the document!
https://developer.android.com/develop/ui/views/animations/reposition-view

How to calculate the correct location of a vertical NSRulerMarker?

What is the correct formula for the location of an NSRulerMarker on a vertical NSRulerView, if the client view is flipped?
The situation: I have a view (let's call it the "main view") that is embedded in an NSScrollView with rulers, and it has subviews. The user can drag these subviews around, and while dragging, I want to indicate the current position on the rulers.
The main view is flipped: The zero point is top-left.
The horizontal position is pretty simple:
NSPoint scroll = myScrollView.documentVisibleRect.origin;
NSRect rect = mySubView.frame;
rulerMarkerDragLeft.markerLocation = rect.origin.x - scroll.x;
However the same method for the vertical position...
rulerMarkerDragTop.markerLocation = rect.origin.y - scroll.y;
does not work. The marker is only in the correct position when the scrollview has been scrolled down to the extreme bottom. For every n points scrolled back up, the marker location is n points too high. This is independent of the main view's size or the size of the visible area.
I can't seem to wrap my head around this problem; I guess there is a value I need to subtract from my result that expresses how far up the scrollview has been scrolled (or rather, how much further it can be scrolled down), but I don't think I can derive that value from myScrollView.documentVisibleRect...?
I may have overlooked something simple, but I can't find the solution.
Edit 2022-11-02 17:17 CET: Found the problem. I had set the NSRulerViews clientView to the contentView of the window. I am now setting it to the "main view" (ie. the view inside the scroll view), and now it works "automagically": I just set the marker locations to the subviews frame, no correction for scroll position or anything else needed.
The solution was simple: the ruler views' clientView needs to be set to the view that is inside the scroll view, not the main content view of the window.
The positioning of the ruler markers is now very straightforward: you just use the local coordinates inside the view, ie. the subviews' frame values.
No correction for scroll position, view height or such necessary.
My mistake was assigning the window's main content view as the rulers' clientView.

Using MapKit, MKMapview how can I orientate the map by aligning two coordinates vertical on the screen

I have two coordinates that represent a portion of a route, and I want to orientate the MKMapView such that the route, polyline is displayed going from the bottom of the screen to the top of the screen.
Currently I first calculate the angle between the two coordinates, and then rotate the map by setting the camera heading, where 90 degrees is facing north and vertically centred on the screen.
Is there perhaps an easier approach, sample code would be great in either Swift or Objective-C.
Currently I first calculate the angle between the two coordinates, and then rotate the map by setting the camera heading, where 90 degrees is facing north and vertically centred on the screen.
You've got the right idea. There's no way to set the map view's heading directly, so setting the camera heading is the right way to go. Be sure to set the map view's rotationEnabled property to YES to get the map view to use the camera's heading, and if you want to always see the map in plan view (i.e. looking straight down), you can set pitchEnabled to NO.

Camera for Spotlight

I have two orthographic cameras. The first one is for the main display and the other one is used for a spotlight effect.
What I want is, if I move the second camera (spotlight), I want the view port rect to be normalized as well. Right now, if I move the second camera's Transform, it looks at the camera's direction but the display is not moving.
So, if the display is at the bottom-right corner, and I move the camera at the top-left corner, I want to display the camera at the top-left corner as well instead of displaying it at the bottom-right corner.
Also, I'm building it on iPad.

How to align the bottom of a UIView with the bottom of the screen always

I want a background image to always be aligned with the bottom of the screen regardless of screen size, iOS Version, or Personal Hotspot messages etc. But none of the interface builder alignment options seem to work in every case.
I have 2 different sized images to fit 3.5' and 4' retina which change via code but their alignment is always thrown off by 'Personal Hotspot' and other messages changing the size of the parent view.
My images are the size of the screen and should fill the whole screen always. There is a black area where tab bar and status bar will overlay.
There are buttons aligned with the background and everything gets thrown out by messages that resize the parent view.
I want the bottom of the UIImageView to be aligned with the bottom of the screen always.
have you tried the contentMode property?
theImageView.contentMode = UIViewContentModeBottom;
There is also a menu item for this in interface builder if you prefer to set it there.
then if you are using auto layout, simply add a bottom space constraint from your image view to the bottom layout guide.
If you're not using auto layout, a fixed bottom margin on the autoresizing mask should do the trick.