在leaflet.js中定义了"position:topleft"这样的控制选项在哪里?我可以创建position:bottomcenter吗?

Where are the control options like "position:topleft" are defined in leaflet.js?Can I create position:bottomcenter?

我需要在 leaflet.js controls.But 中创建自定义 position:bottomcenter 传单仅支持四个角 positions.So,为此我需要知道现有位置如何,如左上角, bottomright 等 created.Can 有人请解释一下这些东西吗? 提前致谢:-)

如果您想将功能添加到 leaflet 以便其他控件不受影响,您可以这样做:

leaflet.js:我相信从第 4900 行开始?

t("top", "left"),
t("top", "right"),
t("bottom", "left"),
t("bottom", "right"),

添加这两行:

t("top", "center"),
t("bottom", "center")

这将允许使用位置 'topcenter' 和 'bottomcenter'

然后只需为 'leaflet-center' 添加 css class:

.leaflet-center {
    left: 50%;
    transform: translate(-50%, 0%);
}