{"id":344592,"date":"2023-01-27T21:00:51","date_gmt":"2023-01-27T21:00:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344592"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344592","title":{"rendered":"<span>\u042f\u043d\u0434\u0435\u043a\u0441 \u041a\u0430\u0440\u0442\u044b \u0438 React Native. \u0427\u0430\u0441\u0442\u044c 2. HUD \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u0430\u0440\u0442\u044b<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0438 \u042f\u043d\u0434\u0435\u043a\u0441 \u041a\u0430\u0440\u0442\u044b \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438 \u0442\u0443\u0434\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u043a\u0430\u0440\u0442\u043e\u0439 \u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 HUD \u043d\u0430 \u043a\u0430\u0440\u0442\u0443. \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0435\u0451 \u043a \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044e.<\/p>\n<h2>HUD<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b \u043a\u0430\u0440\u0442\u0443 (\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 YaMap \u0438 \u0432\u0441\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435) \u0438 \u0431\u043b\u043e\u043a \u0441 \u043d\u0430\u0448\u0438\u043c HUD \u0432 \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u0437\u0430\u0434\u0430\u043b \u0435\u043c\u0443 \u0448\u0438\u0440\u0438\u043d\u0443 \u0438 \u0432\u044b\u0441\u043e\u0442\u0443 \u043f\u043e \u0441\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u043e\u0442 viewport-\u0430. \u042d\u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0431\u043d\u0435\u0439 \u0431\u044b\u043b\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c HUD \u0432\u043d\u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e flex-\u0431\u043e\u043a\u0441\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c HUD \u043f\u043e\u0432\u0435\u0440\u0445 \u043a\u0430\u0440\u0442\u044b, \u0430 \u043d\u0435 \u0432\u043e\u0437\u043b\u0435 \u0441\u043f\u0440\u0430\u0432\u0430\/\u0441\u043b\u0435\u0432\u0430\/\u0432\u0432\u0435\u0440\u0445\u0443\/\u0432\u043d\u0438\u0437\u0443 \u043e\u0442 \u043d\u0435\u0451 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432 \u0441\u0442\u0438\u043b\u044f\u0445 zIndex \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 position, \u043a\u0430\u043a absolute. \u042f \u0441\u0434\u0435\u043b\u0430\u043b HUD, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0442\u0440\u0451\u0445 \u043a\u043d\u043e\u043f\u043e\u043a, \u043a\u043d\u043e\u043f\u043a\u0430-\u0442\u0440\u0438\u0433\u0433\u0435\u0440, \u043f\u043e \u043d\u0435\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043d\u043e\u043f\u043a\u0430 \u0437\u0443\u043c\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0442\u0434\u0430\u043b\u0435\u043d\u0438\u044f (\u0437\u0430\u0434\u0443\u043c\u043a\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u044d\u0442\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u0430\u0440\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u043b\u0430\u0441\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d). \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">export default function Habr() {        return (       &lt;View style={MapStyles.contain}>            &lt;YaMap         showUserPosition={false}         rotateGesturesEnabled={false}         nightMode={true}         mapType={'vector'}         initialRegion={{             lat: 30,             lon: 30,             zoom: 7,             azimuth: 0,             }}         style={MapStyles.map}         >                         &lt;Marker                  children={&lt;Image                     style={MapStyles.marker}                      source={{uri: '\u0412\u0410\u0428\u0415_\u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u0415'}} \/>}                 point={{ lat: 30, lon: 30 }}                 zIndex={6}             \/>               &lt;Circle                 center={{lat: 30, lon: 30}}                 radius={60000}                 fillColor='#5789d9'                 strokeColor='#154ca3'                 strokeWidth={4}                 zIndex={5} \/>              &lt;Polygon                 points={[                     { lat: 30.540273, lon: 31.182331 },                     { lat: 30.070791, lon: 31.928108 },                     { lat: 29.233658, lon: 31.228942 },                     { lat: 29.983355, lon: 30.622998 },                 ]}                 fillColor='#5789d9'                 strokeColor='#154ca3'                 strokeWidth={4}                 zIndex={5}             \/>              &lt;Polyline                 points={[                     { lat: 29.988660, lon: 31.207694 },                     { lat: 29.364817, lon: 31.176281 },                     { lat: 28.634771, lon: 30.862143 },                     { lat: 27.490336, lon: 30.839704},                 ]}                 fillColor='#5789d9'                 strokeColor='#154ca3'                 strokeWidth={4}                 zIndex={4}             \/>          &lt;\/YaMap>              &lt;View style={MapStyles.hud}>              &lt;TouchableOpacity style={MapStyles.hudButton}>                  &lt;Image                      style={MapStyles.hudButtonIMG}                     source={require('..\/Assets\/iconTarget.png')} \/>                              &lt;\/TouchableOpacity>              &lt;TouchableOpacity style={MapStyles.hudButton}>                  &lt;Image                      style={MapStyles.hudButtonIMG}                     source={require('..\/Assets\/iconZoom.png')} \/>                              &lt;\/TouchableOpacity>              &lt;TouchableOpacity style={MapStyles.hudButton}>                  &lt;Image                      style={MapStyles.hudButtonIMG}                     source={require('..\/Assets\/iconFull.png')} \/>                              &lt;\/TouchableOpacity>          &lt;\/View>                &lt;\/View>     ); }<\/code><\/pre>\n<p>\u0421\u0442\u0438\u043b\u0438:<\/p>\n<pre><code class=\"javascript\">export default MapStyles = StyleSheet.create({      contain: {          width: vw(100),         height: vh(100),         justifyContent: 'flex-end',      },      map: {          width: vw(100),         height: vh(100),         zIndex: 1,      },      marker: {          width: 60,         height: 60,         borderRadius: vw(3),         borderWidth: 4,         borderColor: 'black',      },      hud: {          position: 'absolute',         zIndex: 2,         width: vw(100),         height: vw(30),         flexDirection: 'row',         justifyContent: 'space-evenly',         alignItems: 'center',      },      hudButton: {          width: vw(20),         height: vw(20),         backgroundColor: 'black',         justifyContent: 'center',         alignItems: 'center',         borderRadius: vw(10),      },      hudButtonIMG: {          width: vw(12.5),         height: vw(12.5),      },  })<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/929\/bc8\/9c4\/929bc89c4899036798fe8527082517d3.jpg\" width=\"972\" height=\"2160\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/929\/bc8\/9c4\/929bc89c4899036798fe8527082517d3.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u043c\u0435\u0440\u044b<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u0440\u0442\u043e\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u043c\u0435\u0440\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u0440\u0442\u044b getCameraPosition. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a\u0430\u0440\u0442\u044b:<\/p>\n<pre><code class=\"javascript\">map = React.createRef();  ...  &lt;YaMap     ref={this.map}     showUserPosition={false}     rotateGesturesEnabled={false}     nightMode={true}     mapType={'vector'}     initialRegion={{         lat: 30,         lon: 30,         zoom: 7,         azimuth: 0,         }}     style={MapStyles.map} ><\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u043c\u0435\u0440\u044b, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0438\u0441\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<pre><code class=\"javascript\">const getCamera = () => {      return new Promise((resolve, reject) => {        if (this.map.current) {          this.map.current.getCameraPosition((position) => {            resolve(position);          });        } else {          reject('ERROR');        }     })  }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f getCamera \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u043c \u043a\u0430\u043c\u0435\u0440\u044b \u043f\u043e \u0430\u0437\u0438\u043c\u0443\u0442\u0443, \u043d\u0430\u043a\u043b\u043e\u043d \u043a\u0430\u043c\u0435\u0440\u044b, \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440 \u043a\u0430\u043c\u0435\u0440\u044b \u0438 \u0437\u0443\u043c. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a\u0430\u043c\u0435\u0440\u044b<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a\u0430\u043c\u0435\u0440\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0448\u0435\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u043c\u0435\u0440\u044b (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0437\u0443\u043c \u043a\u0430\u043c\u0435\u0440\u044b), \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u0440\u0442\u044b setCenter, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0446\u0435\u043d\u0442\u0440 \u043a\u0430\u043c\u0435\u0440\u044b, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0437\u0443\u043c, \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u043f\u043e \u0430\u0437\u0438\u043c\u0443\u0442\u0443, \u043d\u0430\u043a\u043b\u043e\u043d, \u0432\u0440\u0435\u043c\u044f \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u0430\u043c\u0435\u0440\u0430 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0438 \u0441 \u043a\u0430\u043a\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u043d\u0430 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 (\u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0438\u0434\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 &#8212; smooth \u0438 linear):<\/p>\n<pre><code class=\"javascript\">import { Animation } from 'react-native-yamap';<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u043e\u0432\u0435\u0441\u0438\u043c \u0435\u0451 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">...  const target = async () =>  {      const camera = await getCamera();     if(camera != 'ERROR') {        this.map.current.setCenter(           { lon: 30, lat: 30 },           camera.zoom,            0,            0,            0.6,            Animation.LINEAR);                      }  }  ...  &lt;TouchableOpacity     onPress={target}     style={MapStyles.hudButton}>      &lt;Image          style={MapStyles.hudButtonIMG}         source={require('..\/Assets\/iconTarget.png')} \/>      &lt;\/TouchableOpacity><\/code><\/pre>\n<h2>\u0417\u0443\u043c \u043a\u0430\u043c\u0435\u0440\u044b<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043d\u043e\u043f\u043a\u0438 \u0437\u0443\u043c\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b setZoom. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0437\u0443\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 getCamera \u0438 \u0431\u0443\u0434\u0435\u043c \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0437\u0443\u043c \u043d\u0430 1.2 \u0438 \u0432\u0440\u0435\u043c\u044f \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0437\u0443\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430 0.3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b.<\/p>\n<pre><code class=\"javascript\">...  const zoomUp = async () => {      const camera = await getCamera();     if(camera != 'ERROR') {          this.map.current.setZoom(camera.zoom * 1.2, 0.3);              }  }  ...  &lt;TouchableOpacity      onPress={zoomUp}     style={MapStyles.hudButton}>      &lt;Image          style={MapStyles.hudButtonIMG}         source={require('..\/Assets\/iconZoom.png')} \/>      &lt;\/TouchableOpacity><\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0437\u0443\u043c\u0430.<\/p>\n<h2>\u0412\u0441\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<\/h2>\n<p>\u0421 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Yandex Maps SDK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 fitAllMarkers \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e \u0438 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u0435\u0441\u0438\u043c \u0435\u0433\u043e \u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043a\u043d\u043e\u043f\u043a\u0438.<\/p>\n<pre><code class=\"javascript\">&lt;TouchableOpacity      onPress={() => {          this.map.current.fitAllMarkers();      }}     style={MapStyles.hudButton}>      &lt;Image          style={MapStyles.hudButtonIMG}         source={require('..\/Assets\/iconFull.png')} \/>      &lt;\/TouchableOpacity><\/code><\/pre>\n<h2>\u0418\u0442\u043e\u0433\u043e<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u0430\u0440\u0442\u044b \u0438\u0437 YandexMaps SDK, \u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0435\u0449\u0451 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439. \u0421\u043e\u0432\u0435\u0442\u0443\u044e \u0442\u0430\u043a\u0436\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0438\u043b\u044f\u043c\u0438 \u043a\u0430\u0440\u0442\u044b \u0438 \u043a\u0430\u043a \u0435\u0451 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/713322\/\" rel=\"noopener noreferrer nofollow\"><em>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0447\u0430\u0441\u0442\u044c<\/em><\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/713374\/\"> https:\/\/habr.com\/ru\/post\/713374\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0438 \u042f\u043d\u0434\u0435\u043a\u0441 \u041a\u0430\u0440\u0442\u044b \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438 \u0442\u0443\u0434\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u043a\u0430\u0440\u0442\u043e\u0439 \u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 HUD \u043d\u0430 \u043a\u0430\u0440\u0442\u0443. \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0435\u0451 \u043a \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044e.<\/p>\n<h2>HUD<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b \u043a\u0430\u0440\u0442\u0443 (\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 YaMap \u0438 \u0432\u0441\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435) \u0438 \u0431\u043b\u043e\u043a \u0441 \u043d\u0430\u0448\u0438\u043c HUD \u0432 \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u0437\u0430\u0434\u0430\u043b \u0435\u043c\u0443 \u0448\u0438\u0440\u0438\u043d\u0443 \u0438 \u0432\u044b\u0441\u043e\u0442\u0443 \u043f\u043e \u0441\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u043e\u0442 viewport-\u0430. \u042d\u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0431\u043d\u0435\u0439 \u0431\u044b\u043b\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c HUD \u0432\u043d\u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e flex-\u0431\u043e\u043a\u0441\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c HUD \u043f\u043e\u0432\u0435\u0440\u0445 \u043a\u0430\u0440\u0442\u044b, \u0430 \u043d\u0435 \u0432\u043e\u0437\u043b\u0435 \u0441\u043f\u0440\u0430\u0432\u0430\/\u0441\u043b\u0435\u0432\u0430\/\u0432\u0432\u0435\u0440\u0445\u0443\/\u0432\u043d\u0438\u0437\u0443 \u043e\u0442 \u043d\u0435\u0451 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432 \u0441\u0442\u0438\u043b\u044f\u0445 zIndex \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 position, \u043a\u0430\u043a absolute. \u042f \u0441\u0434\u0435\u043b\u0430\u043b HUD, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0442\u0440\u0451\u0445 \u043a\u043d\u043e\u043f\u043e\u043a, \u043a\u043d\u043e\u043f\u043a\u0430-\u0442\u0440\u0438\u0433\u0433\u0435\u0440, \u043f\u043e \u043d\u0435\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043d\u043e\u043f\u043a\u0430 \u0437\u0443\u043c\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0442\u0434\u0430\u043b\u0435\u043d\u0438\u044f (\u0437\u0430\u0434\u0443\u043c\u043a\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u044d\u0442\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u0430\u0440\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u043b\u0430\u0441\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d). \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">export default function Habr() {        return (       &lt;View style={MapStyles.contain}>            &lt;YaMap         showUserPosition={false}         rotateGesturesEnabled={false}         nightMode={true}         mapType={'vector'}         initialRegion={{             lat: 30,             lon: 30,             zoom: 7,             azimuth: 0,             }}         style={MapStyles.map}         >                         &lt;Marker                  children={&lt;Image                     style={MapStyles.marker}                      source={{uri: '\u0412\u0410\u0428\u0415_\u0418\u0417\u041e\u0411\u0420\u0410\u0416\u0415\u041d\u0418\u0415'}} \/>}                 point={{ lat: 30, lon: 30 }}                 zIndex={6}             \/>               &lt;Circle                 center={{lat: 30, lon: 30}}                 radius={60000}                 fillColor='#5789d9'                 strokeColor='#154ca3'                 strokeWidth={4}                 zIndex={5} \/>              &lt;Polygon                 points={[                     { lat: 30.540273, lon: 31.182331 },                     { lat: 30.070791, lon: 31.928108 },                     { lat: 29.233658, lon: 31.228942 },                     { lat: 29.983355, lon: 30.622998 },                 ]}                 fillColor='#5789d9'                 strokeColor='#154ca3'                 strokeWidth={4}                 zIndex={5}             \/>              &lt;Polyline                 points={[                     { lat: 29.988660, lon: 31.207694 },                     { lat: 29.364817, lon: 31.176281 },                     { lat: 28.634771, lon: 30.862143 },                     { lat: 27.490336, lon: 30.839704},                 ]}                 fillColor='#5789d9'                 strokeColor='#154ca3'                 strokeWidth={4}                 zIndex={4}             \/>          &lt;\/YaMap>              &lt;View style={MapStyles.hud}>              &lt;TouchableOpacity style={MapStyles.hudButton}>                  &lt;Image                      style={MapStyles.hudButtonIMG}                     source={require('..\/Assets\/iconTarget.png')} \/>                              &lt;\/TouchableOpacity>              &lt;TouchableOpacity style={MapStyles.hudButton}>                  &lt;Image                      style={MapStyles.hudButtonIMG}                     source={require('..\/Assets\/iconZoom.png')} \/>                              &lt;\/TouchableOpacity>              &lt;TouchableOpacity style={MapStyles.hudButton}>                  &lt;Image                      style={MapStyles.hudButtonIMG}                     source={require('..\/Assets\/iconFull.png')} \/>                              &lt;\/TouchableOpacity>          &lt;\/View>                &lt;\/View>     ); }<\/code><\/pre>\n<p>\u0421\u0442\u0438\u043b\u0438:<\/p>\n<pre><code class=\"javascript\">export default MapStyles = StyleSheet.create({      contain: {          width: vw(100),         height: vh(100),         justifyContent: 'flex-end',      },      map: {          width: vw(100),         height: vh(100),         zIndex: 1,      },      marker: {          width: 60,         height: 60,         borderRadius: vw(3),         borderWidth: 4,         borderColor: 'black',      },      hud: {          position: 'absolute',         zIndex: 2,         width: vw(100),         height: vw(30),         flexDirection: 'row',         justifyContent: 'space-evenly',         alignItems: 'center',      },      hudButton: {          width: vw(20),         height: vw(20),         backgroundColor: 'black',         justifyContent: 'center',         alignItems: 'center',         borderRadius: vw(10),      },      hudButtonIMG: {          width: vw(12.5),         height: vw(12.5),      },  })<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u043c\u0435\u0440\u044b<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u0440\u0442\u043e\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u043c\u0435\u0440\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u0440\u0442\u044b getCameraPosition. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a\u0430\u0440\u0442\u044b:<\/p>\n<pre><code class=\"javascript\">map = React.createRef();  ...  &lt;YaMap     ref={this.map}     showUserPosition={false}     rotateGesturesEnabled={false}     nightMode={true}     mapType={'vector'}     initialRegion={{         lat: 30,         lon: 30,         zoom: 7,         azimuth: 0,         }}     style={MapStyles.map} ><\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u043c\u0435\u0440\u044b, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0438\u0441\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<pre><code class=\"javascript\">const getCamera = () => {      return new Promise((resolve, reject) => {        if (this.map.current) {          this.map.current.getCameraPosition((position) => {            resolve(position);          });        } else {          reject('ERROR');        }     })  }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f getCamera \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u043c \u043a\u0430\u043c\u0435\u0440\u044b \u043f\u043e \u0430\u0437\u0438\u043c\u0443\u0442\u0443, \u043d\u0430\u043a\u043b\u043e\u043d \u043a\u0430\u043c\u0435\u0440\u044b, \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440 \u043a\u0430\u043c\u0435\u0440\u044b \u0438 \u0437\u0443\u043c. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a\u0430\u043c\u0435\u0440\u044b<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a\u0430\u043c\u0435\u0440\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0448\u0435\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u043c\u0435\u0440\u044b (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0437\u0443\u043c \u043a\u0430\u043c\u0435\u0440\u044b), \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u0440\u0442\u044b setCenter, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0446\u0435\u043d\u0442\u0440 \u043a\u0430\u043c\u0435\u0440\u044b, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0437\u0443\u043c, \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u043f\u043e \u0430\u0437\u0438\u043c\u0443\u0442\u0443, \u043d\u0430\u043a\u043b\u043e\u043d, \u0432\u0440\u0435\u043c\u044f \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u0430\u043c\u0435\u0440\u0430 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0438 \u0441 \u043a\u0430\u043a\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u043d\u0430 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 (\u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0438\u0434\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 &#8212; smooth \u0438 linear):<\/p>\n<pre><code class=\"javascript\">import { Animation } from 'react-native-yamap';<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u043e\u0432\u0435\u0441\u0438\u043c \u0435\u0451 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">...  const target = async () =>  {      const camera = await getCamera();     if(camera != 'ERROR') {        this.map.current.setCenter(           { lon: 30, lat: 30 },           camera.zoom,            0,            0,            0.6,            Animation.LINEAR);                      }  }  ...  &lt;TouchableOpacity     onPress={target}     style={MapStyles.hudButton}>      &lt;Image          style={MapStyles.hudButtonIMG}         source={require('..\/Assets\/iconTarget.png')} \/>      &lt;\/TouchableOpacity><\/code><\/pre>\n<h2>\u0417\u0443\u043c \u043a\u0430\u043c\u0435\u0440\u044b<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043d\u043e\u043f\u043a\u0438 \u0437\u0443\u043c\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u044b setZoom. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0437\u0443\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 getCamera \u0438 \u0431\u0443\u0434\u0435\u043c \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0437\u0443\u043c \u043d\u0430 1.2 \u0438 \u0432\u0440\u0435\u043c\u044f \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0437\u0443\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430 0.3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b.<\/p>\n<pre><code class=\"javascript\">...  const zoomUp = async () => {      const camera = await getCamera();     if(camera != 'ERROR') {          this.map.current.setZoom(camera.zoom * 1.2, 0.3);              }  }  ...  &lt;TouchableOpacity      onPress={zoomUp}     style={MapStyles.hudButton}>      &lt;Image          style={MapStyles.hudButtonIMG}         source={require('..\/Assets\/iconZoom.png')} \/>      &lt;\/TouchableOpacity><\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0437\u0443\u043c\u0430.<\/p>\n<h2>\u0412\u0441\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<\/h2>\n<p>\u0421 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Yandex Maps SDK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 fitAllMarkers \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e \u0438 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u0435\u0441\u0438\u043c \u0435\u0433\u043e \u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043a\u043d\u043e\u043f\u043a\u0438.<\/p>\n<pre><code class=\"javascript\">&lt;TouchableOpacity      onPress={() => {          this.map.current.fitAllMarkers();      }}     style={MapStyles.hudButton}>      &lt;Image          style={MapStyles.hudButtonIMG}         source={require('..\/Assets\/iconFull.png')} \/>      &lt;\/TouchableOpacity><\/code><\/pre>\n<h2>\u0418\u0442\u043e\u0433\u043e<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u0430\u0440\u0442\u044b \u0438\u0437 YandexMaps SDK, \u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0435\u0449\u0451 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439. \u0421\u043e\u0432\u0435\u0442\u0443\u044e \u0442\u0430\u043a\u0436\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0438\u043b\u044f\u043c\u0438 \u043a\u0430\u0440\u0442\u044b \u0438 \u043a\u0430\u043a \u0435\u0451 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/713322\/\" rel=\"noopener noreferrer nofollow\"><em>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0447\u0430\u0441\u0442\u044c<\/em><\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/713374\/\"> https:\/\/habr.com\/ru\/post\/713374\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344592","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344592"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344592\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}