From 088b4f59fefcaaaba1e1205260a1124c90f7c4a1 Mon Sep 17 00:00:00 2001 From: Kai O'Reilly Date: Tue, 19 Nov 2024 17:00:59 -0800 Subject: [PATCH] do not display toolbar navigation on web in content since it is superseded by browser navigation (#1279) --- content/content.go | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/content/content.go b/content/content.go index 38930e4f2e..a68423eca5 100644 --- a/content/content.go +++ b/content/content.go @@ -21,6 +21,7 @@ import ( "cogentcore.org/core/icons" "cogentcore.org/core/keymap" "cogentcore.org/core/styles" + "cogentcore.org/core/system" "cogentcore.org/core/tree" ) @@ -267,28 +268,31 @@ func (ct *Content) makeCategories() { } func (ct *Content) MakeToolbar(p *tree.Plan) { - tree.Add(p, func(w *core.Button) { - w.SetIcon(icons.ArrowBack).SetKey(keymap.HistPrev) - w.SetTooltip("Back") - w.Updater(func() { - w.SetEnabled(ct.historyIndex > 0) - }) - w.OnClick(func(e events.Event) { - ct.historyIndex-- - ct.open(ct.history[ct.historyIndex].URL, false) // do not add to history while navigating history - }) - }) - tree.Add(p, func(w *core.Button) { - w.SetIcon(icons.ArrowForward).SetKey(keymap.HistNext) - w.SetTooltip("Forward") - w.Updater(func() { - w.SetEnabled(ct.historyIndex < len(ct.history)-1) + // Superseded by browser navigation on web. + if core.TheApp.Platform() != system.Web { + tree.Add(p, func(w *core.Button) { + w.SetIcon(icons.ArrowBack).SetKey(keymap.HistPrev) + w.SetTooltip("Back") + w.Updater(func() { + w.SetEnabled(ct.historyIndex > 0) + }) + w.OnClick(func(e events.Event) { + ct.historyIndex-- + ct.open(ct.history[ct.historyIndex].URL, false) // do not add to history while navigating history + }) }) - w.OnClick(func(e events.Event) { - ct.historyIndex++ - ct.open(ct.history[ct.historyIndex].URL, false) // do not add to history while navigating history + tree.Add(p, func(w *core.Button) { + w.SetIcon(icons.ArrowForward).SetKey(keymap.HistNext) + w.SetTooltip("Forward") + w.Updater(func() { + w.SetEnabled(ct.historyIndex < len(ct.history)-1) + }) + w.OnClick(func(e events.Event) { + ct.historyIndex++ + ct.open(ct.history[ct.historyIndex].URL, false) // do not add to history while navigating history + }) }) - }) + } tree.Add(p, func(w *core.Button) { w.SetIcon(icons.Search).SetKey(keymap.Menu) w.SetTooltip("Search")