目录

Interface (CameraUpdate)

导入模块

import { map, mapCommon } from '@kit.MapKit';

CameraUpdate

CameraUpdate定义了相机移动参数。CameraUpdate的创建方法参见newCameraPosition、newLatLng和newLatLngBounds等函数,获取地图的控制器类mapController参见MapComponentController。

模型约束: 此接口仅可在Stage模型下使用。

元服务API: 从版本4.1.0(11)开始,该接口支持在元服务中使用。

系统能力: SystemCapability.Map.Core

起始版本: 4.1.0(11)

示例:

let target: mapCommon.LatLng = {
  latitude: 39.9,
  longitude: 116.4
};
let cameraPosition: mapCommon.CameraPosition = {
  target: target,
  zoom: 10
};
// 新建CameraUpdate对象
let cameraUpdate: map.CameraUpdate = map.newCameraPosition(cameraPosition);
// 移动相机
this.mapController.moveCamera(cameraUpdate);