different speed buttons

This commit is contained in:
Torsten Ruger 2015-11-01 18:11:00 +02:00
parent f2b14c743d
commit 752310ab0a
2 changed files with 35 additions and 8 deletions

View File

@ -31,7 +31,7 @@ $susy: (
} }
.status_view { .status_view {
@include span(2 at 22); @include span(4 at 20);
line-height : 1.25em; line-height : 1.25em;
} }
@ -56,17 +56,29 @@ $susy: (
background-color: #C5FFD9; background-color: #C5FFD9;
} }
.statement {
margin-left: 10px;
}
.act{ .act{
background-color: #00B3FF; background-color: #00B3FF;
-moz-border-radius: 7px; -moz-border-radius: 7px;
-webkit-border-radius: 7px; -webkit-border-radius: 7px;
font-size: 100%; font-size: 100%;
} }
.run{ .crawl{
background-color: #00FF37; background-color: #009900;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}
.run{
background-color: #00CC33;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}
.wizz{
background-color: #00FF66;
-moz-border-radius: 7px; -moz-border-radius: 7px;
-webkit-border-radius: 7px; -webkit-border-radius: 7px;
font-size: 100%;
} }
.bright { .bright {
@ -76,3 +88,12 @@ $susy: (
-moz-border-radius: 7px; -moz-border-radius: 7px;
-webkit-border-radius: 7px; -webkit-border-radius: 7px;
} }
.fade_in {
transition: background-color 100ms linear;
padding-right: 6px;
padding-left: 6px;
background-color: #00E3FF ;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}

View File

@ -11,7 +11,9 @@ class StatusView < ElementView
@element = div(".status_view") << @element = div(".status_view") <<
div("h4" , "Interpreter" ) << div("h4" , "Interpreter" ) <<
div("button.act" , "Next") << div("button.act" , "Next") <<
div("button.crawl" , "Crawl") <<
div("button.run" , "Run") << div("button.run" , "Run") <<
div("button.wizz" , "Wizz") <<
div( "br") << div( "br") <<
div("span.clock" , clock_text) << div("span.clock" , clock_text) <<
div( "br") << div( "br") <<
@ -22,14 +24,18 @@ class StatusView < ElementView
div("span.stdout") div("span.stdout")
# set up event handler # set up event handler
@element.at_css(".act").on("click") { self.update } @element.at_css(".act").on("click") { self.update }
@element.at_css(".run").on("mousedown") { self.start } @element.at_css(".crawl").on("mousedown") { self.start( 0.5 ) }
@element.at_css(".run").on("mousedown") { self.start( 0.1 ) }
@element.at_css(".wizz").on("mousedown") { self.start( 0.05 ) }
@element.at_css(".crawl").on("mouseup") { self.stop }
@element.at_css(".run").on("mouseup") { self.stop } @element.at_css(".run").on("mouseup") { self.stop }
@element.at_css(".wizz").on("mouseup") { self.stop }
return @element return @element
end end
def start def start(speed)
@running = true @running = speed
run run
end end
def stop def stop
@ -42,7 +48,7 @@ class StatusView < ElementView
self.update self.update
self.run self.run
end end
proc.after( 0.001 ) proc.after( @running )
rescue => e rescue => e
puts e puts e
end end