當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


JavaScript ArcGIS Popup.location用法及代碼示例


基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/widgets/Popup"], (Popup) => { /* code goes here */ });

ESM: import Popup from "@arcgis/core/widgets/Popup";

類: esri/widgets/Popup

繼承: Popup > Widget > Accessor

自從:用於 JavaScript 4.0 的 ArcGIS API

用法說明

Popup.location函數(或屬性)的定義如下:

location Point autocast


用於定位彈出窗口的點。通過選擇函數查看彈出窗口時會自動設置此值。如果使用彈出窗口顯示與Map中的要素無關的內容(例如任務的結果),則必須在使彈出窗口對用戶可見之前設置此屬性。

例子:

// Sets the location of the popup to the center of the view
view.popup.location = view.center;
// Displays the popup
view.popup.visible = true;
// Sets the location of the popup to a specific place (using autocast)
// Note: using latlong only works if view is in Web Mercator or WGS84 spatial reference.
view.popup.location = {latitude: 34.0571, longitude: -117.1968};
// Sets the location of the popup to the location of a click on the view
view.on("click", function(event){
  view.popup.location = event.mapPoint;
  // Displays the popup
  view.popup.visible = true;
});

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 Popup.location。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。