Map doesn't recenter after interac with the graph on mobile
オープン
まだ誰も着手していません。
bug
P3
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
The app works completely fine on computer but has issues recenter on phone after interacing with the map a bit.
Heres a sample app for replicating the issue;
import dash
from dash import dcc, html, Input, Output
import plotly.express as px
import plotly.graph_objects as go
# Create a Dash app
app = dash.Dash(__name__)
# City data with coordinates
cities = {
"New York": {"lat": 40.7128, "lon": -74.0060},
"London": {"lat": 51.5074, "lon": -0.1278},
"Tokyo": {"lat": 35.6895, "lon": 139.6917},
"Sydney": {"lat": -33.8688, "lon": 151.2093},
"Toronto": {"lat": 43.651070, "lon": -79.347015},
}
# Initial map centered at a default location
fig = go.Figure(go.Scattermapbox())
fig.update_layout(
mapbox_style="open-street-map",
mapbox_center={"lat": 0, "lon": 0},
mapbox_zoom=1,
)
# App layout
app.layout = html.Div([
html.H1("City Map Viewer", style={"textAlign": "center"}),
dcc.Dropdown(
id="city-dropdown",
options=[{"label": city, "value": city} for city in cities.keys()],
placeholder="Select a city",
style={"width": "50%", "margin": "auto"}
),
dcc.Graph(id="map", figure=fig)
])
# Callback to update the map based on dropdown selection
@app.callback(
Output("map", "figure"),
Input("city-dropdown", "value")
)
def update_map(selected_city):
if not selected_city:
return fig # Return the default map if no city is selected
# Get the coordinates of the selected city
city_coords = cities[selected_city]
# Update the map figure
new_fig = go.Figure(go.Scattermapbox())
new_fig.update_layout(
mapbox_style="open-street-map",
mapbox_center={"lat": city_coords["lat"], "lon": city_coords["lon"]},
mapbox_zoom=10,
)
# Add a marker for the selected city
new_fig.add_trace(go.Scattermapbox(
lat=[city_coords["lat"]],
lon=[city_coords["lon"]],
mode="markers",
marker=dict(size=10, color="red"),
text=[selected_city],
))
return new_fig
# Run the app
if __name__ == "__main__":
app.run_server(debug=True)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供されている Dash サンプルを実行してスマートフォン上で地図の操作を再現し、デスクトップでの挙動と比較します。次に、サンプルの dcc.Graph コールバックから地図の更新と再センタリングの挙動を追跡し、モバイルで事前に操作した後でも都市を選択すると地図が正しく再センタリングされることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- plotly, python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100