ui.Map.setControlVisibility
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
กำหนดระดับการเข้าถึงของตัวควบคุมบนแผนที่
แสดงผล ui.Map นี้
การใช้งาน | การคืนสินค้า |
---|
Map.setControlVisibility(all, layerList, zoomControl, scaleControl, mapTypeControl, fullscreenControl, drawingToolsControl) | ui.Map |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ ui.map | ui.Map | อินสแตนซ์ ui.Map |
all | บูลีน ไม่บังคับ | จะแสดงตัวควบคุมทั้งหมดหรือไม่ False จะซ่อนตัวควบคุมทั้งหมด ส่วน True จะแสดงตัวควบคุมทั้งหมด ลบล้างโดยพารามิเตอร์ที่ตั้งค่าแยกกัน โปรดทราบว่าการตั้งค่านี้อย่างชัดเจนจะมีผลต่อการควบคุมเพิ่มเติมที่เพิ่มเข้ามาในอนาคต |
layerList | บูลีน ไม่บังคับ | เมื่อเป็นเท็จ จะซ่อนแผงรายการเลเยอร์ หรือเมื่อเป็นจริง จะอนุญาตให้กำหนดระดับการมองเห็นของแผงรายการเลเยอร์ได้โดยดูจากเลเยอร์ที่มีอยู่ในรายการ ค่าเริ่มต้นคือแสดงรายการ |
zoomControl | บูลีน ไม่บังคับ | ตัวควบคุมการซูมจะแสดงหรือไม่ ค่าเริ่มต้นคือ True |
scaleControl | บูลีน ไม่บังคับ | ว่าจะแสดงตัวควบคุมที่ระบุมาตราส่วนที่ระดับการซูมปัจจุบันของแผนที่หรือไม่ ค่าเริ่มต้นคือ True |
mapTypeControl | บูลีน ไม่บังคับ | ว่าจะแสดงตัวควบคุมที่อนุญาตให้ผู้ใช้เปลี่ยนแผนที่ฐานหรือไม่ ค่าเริ่มต้นคือ True |
fullscreenControl | บูลีน ไม่บังคับ | ว่าจะแสดงตัวควบคุมที่อนุญาตให้ผู้ใช้ทำให้แผนที่เป็นแบบเต็มหน้าจอหรือไม่ ค่าเริ่มต้นคือ True |
drawingToolsControl | บูลีน ไม่บังคับ | ว่าจะแสดงตัวควบคุมที่อนุญาตให้ผู้ใช้เพิ่มหรือแก้ไขเครื่องมือวาดรูปเรขาคณิตหรือไม่ ค่าเริ่มต้นเป็นจริงหากก่อนหน้านี้มีการเพิ่มเครื่องมือวาดภาพลงในแผนที่ ระบบจะละเว้นหากไม่ได้เพิ่มเครื่องมือวาดลงในแผนที่ก่อนหน้านี้ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eControls the visibility of map elements like zoom, scale, layer list, and map type selection.\u003c/p\u003e\n"],["\u003cp\u003eAllows for customization by showing or hiding individual controls or all at once.\u003c/p\u003e\n"],["\u003cp\u003eUses Boolean values (true/false) to set the visibility of each control element.\u003c/p\u003e\n"],["\u003cp\u003eProvides control over the fullscreen and drawing tools visibility, if enabled on the map.\u003c/p\u003e\n"],["\u003cp\u003eAffects the display of the layer list panel based on the presence of layers and user preference.\u003c/p\u003e\n"]]],["The `Map.setControlVisibility` function modifies the visibility of map controls. It accepts boolean arguments to show or hide controls: `all`, `layerList`, `zoomControl`, `scaleControl`, `mapTypeControl`, `fullscreenControl`, and `drawingToolsControl`. Setting `all` to true/false shows/hides all controls unless overridden. `layerList` determines the visibility of the layer list panel. The function returns the modified `ui.Map` instance, and each control defaults to visible (true), except `drawingToolsControl` that needs the drawing tools to have been added before.\n"],null,["# ui.Map.setControlVisibility\n\n\u003cbr /\u003e\n\nSets the visibility of the controls on the map.\n\n\u003cbr /\u003e\n\nReturns this ui.Map.\n\n| Usage | Returns |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|\n| Map.setControlVisibility`(`*all* `, `*layerList* `, `*zoomControl* `, `*scaleControl* `, `*mapTypeControl* `, `*fullscreenControl* `, `*drawingToolsControl*`)` | ui.Map |\n\n| Argument | Type | Details |\n|-----------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.map` | ui.Map | The ui.Map instance. |\n| `all` | Boolean, optional | Whether to show all controls. False hides all controls; true shows all controls. Overridden by individually set parameters. Note that setting this explicitly will affect any additional controls added in the future. |\n| `layerList` | Boolean, optional | When false, hides the layer list panel or, when true, allows the layer list panel's visibility to be determined by the presence of layers in the list. The default is to show the list. |\n| `zoomControl` | Boolean, optional | Whether the zoom control is visible. Defaults to true. |\n| `scaleControl` | Boolean, optional | Whether to show the control which indicates the scale at the map's current zoom level. Defaults to true. |\n| `mapTypeControl` | Boolean, optional | Whether to show the control that allows the user to change the base map. Defaults to true. |\n| `fullscreenControl` | Boolean, optional | Whether to show the control that allows the user to make the map full-screen. Defaults to true. |\n| `drawingToolsControl` | Boolean, optional | Whether to show the control that allows the user to add or edit the geometry drawing tools. Defaults to true if the drawing tools were previously added to the map. Ignored if the drawing tools were not previously added to the map. |"]]