Skip to content

Commit

Permalink
configured_plots: detect mobile and disable panning tool by default
Browse files Browse the repository at this point in the history
  • Loading branch information
bkueng committed Dec 9, 2023
1 parent 85467e4 commit d38512d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/plot_app/configured_plots.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" This contains the list of all drawn plots on the log plotting page """

import re
from html import escape

from bokeh.layouts import column
Expand Down Expand Up @@ -1009,6 +1010,12 @@ def param_changes_button_clicked():
param_changes_button.on_click(param_changes_button_clicked)


user_agent = curdoc().session_context.request.headers.get("User-Agent", "")
is_mobile = re.search(r'Mobile|iP(hone|od|ad)|Android|BlackBerry|'
r'IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|'
r'Minimo|Opera M(obi|ini)|Blazer|Dolfin|'
r'Dolphin|Skyfire|Zune', user_agent)

jinja_plot_data = []
for i in range(len(plots)):
if plots[i] is None:
Expand All @@ -1027,6 +1034,9 @@ def param_changes_button_clicked():
'fragment': fragment,
'title': plot_title
})
if is_mobile is not None and hasattr(plots[i], 'toolbar'):
# Disable panning on mobile by default
plots[i].toolbar.active_drag = None


# changed parameters
Expand Down

0 comments on commit d38512d

Please sign in to comment.