Skip to content

Instantly share code, notes, and snippets.

@mewmew
Created December 21, 2018 01:44
Show Gist options
  • Save mewmew/b8d7ac088471ffa9b4655d3416437f9c to your computer and use it in GitHub Desktop.
Save mewmew/b8d7ac088471ffa9b4655d3416437f9c to your computer and use it in GitHub Desktop.
Whisper Visualization without Simulator diff
diff --git a/keys.go b/keys.go
index 7e92455..7909b25 100644
--- a/keys.go
+++ b/keys.go
@@ -15,9 +15,9 @@ func (p *Page) KeyListener(e *vecty.Event) {
p.webgl.ToggleWobbling()
case "f":
p.ApplyForces()
- case "]":
- p.simulationWidget.StepForward()
- case "[":
- p.simulationWidget.StepBackward()
+ //case "]":
+ // p.simulationWidget.StepForward()
+ //case "[":
+ // p.simulationWidget.StepBackward()
}
}
diff --git a/page.go b/page.go
index 5ca6e08..f92c82d 100644
--- a/page.go
+++ b/page.go
@@ -22,17 +22,17 @@ type Page struct {
loaded bool
isSimulating bool
- loader *widgets.Loader
- network *widgets.NetworkSelector
- forceEditor *widgets.ForceEditor
- graphics *widgets.Graphics
- simulationWidget *widgets.Simulation
- statsWidget *widgets.Stats
+ loader *widgets.Loader
+ network *widgets.NetworkSelector
+ forceEditor *widgets.ForceEditor
+ graphics *widgets.Graphics
+ //simulationWidget *widgets.Simulation
+ //statsWidget *widgets.Stats
- statsPage *StatsPage
- faqPage *FAQPage
+ //statsPage *StatsPage
+ faqPage *FAQPage
- simulation *Simulation
+ //simulation *Simulation
activeView string
}
@@ -49,9 +49,9 @@ func NewPage() *Page {
page.network = widgets.NewNetworkSelector(page.onNetworkChange)
page.forceEditor = widgets.NewForceEditor(page.onForcesApply)
page.graphics = widgets.NewGraphics(page.webgl)
- page.simulationWidget = widgets.NewSimulation("http://localhost:8084", page.startSimulation, page.replaySimulation, page.stepSimulation)
- page.statsWidget = widgets.NewStats()
- page.statsPage = NewStatsPage()
+ //page.simulationWidget = widgets.NewSimulation("http://localhost:8084", page.startSimulation, page.replaySimulation, page.stepSimulation)
+ //page.statsWidget = widgets.NewStats()
+ //page.statsPage = NewStatsPage()
page.faqPage = NewFAQPage()
return page
}
@@ -84,14 +84,14 @@ func (p *Page) Render() vecty.ComponentOrHTML {
vecty.Markup(
vecty.MarkupIf(!p.loaded, vecty.Style("visibility", "hidden")),
),
- p.simulationWidget,
+ //p.simulationWidget,
elem.Div(
vecty.Markup(
vecty.MarkupIf(p.isSimulating,
vecty.Attribute("disabled", "true"),
),
),
- p.statsWidget,
+ //p.statsWidget,
),
),
),
@@ -115,9 +115,9 @@ func (p *Page) Render() vecty.ComponentOrHTML {
),
p.webgl,
),
- vecty.If(p.activeView == ViewStats,
- p.statsPage,
- ),
+ //vecty.If(p.activeView == ViewStats,
+ // p.statsPage,
+ //),
vecty.If(p.activeView == ViewFAQ,
p.faqPage,
),
@@ -154,9 +154,9 @@ func (p *Page) onNetworkChange(network *network.Network) {
p.switchView(View3D)
// reset simulation and stats
- p.simulation = nil
- p.simulationWidget.Reset()
- p.statsWidget.Reset()
+ //p.simulation = nil
+ //p.simulationWidget.Reset()
+ //p.statsWidget.Reset()
config := p.forceEditor.Config()
p.layout = layout.New(network.Data, config.Config)
@@ -172,6 +172,7 @@ func (p *Page) onNetworkChange(network *network.Network) {
go p.UpdateGraph()
}
+/*
// startSimulation is called on the end of each simulation round.
// Returns numnber of timesteps for the simulation.
// TODO(divan): maybe sim widget need to have access to whole simulation?
@@ -210,6 +211,7 @@ func (p *Page) replaySimulation() {
}
p.webgl.AnimatePropagation(p.simulation.plog)
}
+*/
func (p *Page) header() *vecty.HTML {
return elem.Section(
@@ -276,6 +278,7 @@ func (p *Page) renderTabs() *vecty.HTML {
)
}
+/*
// stepSimulation animates a single step from the last simulation.
func (p *Page) stepSimulation(step int) {
if p.simulation == nil {
@@ -283,3 +286,4 @@ func (p *Page) stepSimulation(step int) {
}
p.webgl.AnimateOneStep(p.simulation.plog, step)
}
+*/
diff --git a/propagation.go b/propagation.go
index 98922d9..da8efaa 100644
--- a/propagation.go
+++ b/propagation.go
@@ -1,3 +1,5 @@
+//+build ignore
+
package main
import (
diff --git a/simulation.go b/simulation.go
index 0995c8d..12f0898 100644
--- a/simulation.go
+++ b/simulation.go
@@ -1,3 +1,5 @@
+//+build ignore
+
package main
import (
diff --git a/stats.go b/stats.go
index d693847..8001dc2 100644
--- a/stats.go
+++ b/stats.go
@@ -1,3 +1,5 @@
+//+build ignore
+
package main
import (
diff --git a/stats_page.go b/stats_page.go
index 8e3d4ac..f232ede 100644
--- a/stats_page.go
+++ b/stats_page.go
@@ -1,3 +1,5 @@
+//+build ignore
+
package main
import (
diff --git a/widgets/simulation.go b/widgets/simulation.go
index cfa63cb..5925294 100644
--- a/widgets/simulation.go
+++ b/widgets/simulation.go
@@ -1,3 +1,5 @@
+//+build ignore
+
package widgets
import (
diff --git a/widgets/stats.go b/widgets/stats.go
index 80e25a7..28fa927 100644
--- a/widgets/stats.go
+++ b/widgets/stats.go
@@ -1,3 +1,5 @@
+//+build ignore
+
package widgets
import (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment