Skip to content

Commit

Permalink
Operands highlightining
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Staal committed Jan 26, 2013
1 parent 5399cbe commit 4b9bc30
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 7 deletions.
20 changes: 17 additions & 3 deletions lib/foundry-xray/app/assets/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Application
@sliderPrev = $('#timeline button.prev')
@sliderFNext = $('#timeline button.fnext')
@sliderFPrev = $('#timeline button.fprev')

@transforms = $('#transforms')

@buildZoomer()
Expand Down Expand Up @@ -73,6 +74,7 @@ class Application
@renewZoomer()
@renewSelector()
@renewSlider()
@renewNaming()

@title.html @input.function.title()
catch error
Expand Down Expand Up @@ -128,16 +130,28 @@ class Application
renewZoomer: ->
@zoomButton.removeClass 'active'

renewNaming: ->
elements = $('.naming')
drawer = @drawer

elements.click ->
active = $(@).hasClass('active')
needle = @innerHTML
elements.removeClass('active')

unless active
elements.filter(-> @innerHTML == needle).addClass('active')
drawer.repaint()

buildZoomer: ->
@zoomButton.click =>
if @zoomButton.hasClass('active')
@zoomButton.removeClass 'active'
@zoomButton.removeClass('active')
@drawer.unfit()
else
@zoomButton.addClass 'active'
@zoomButton.addClass('active')
@drawer.fit(@svg.width(), @svg.height())


buildSelector: ->
groups = ['Present', 'Removed'].map (x) -> $("<optgroup label='#{x}'></optgroup>")

Expand Down
4 changes: 4 additions & 0 deletions lib/foundry-xray/app/assets/javascripts/lib/drawer.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class @Drawer
@setupEntities()
@draw()

repaint: ->
@container.attr("transform", "translate(0,1)")
@container.attr("transform", "translate(0,0)")

fit: (width, height) ->
@zoomValue = [@constructor.zoom.translate(), @constructor.zoom.scale()]

Expand Down
7 changes: 7 additions & 0 deletions lib/foundry-xray/app/assets/stylesheets/graph.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ svg
a
color: rgb(184, 52, 0)

span.naming
cursor: pointer
text-decoration: underline

&.active
background-color: yellow

rect
stroke-width: 2px
stroke: #333
Expand Down
2 changes: 1 addition & 1 deletion lib/foundry-xray/app/views/nodes/argument.jst.mustache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{{type}}} %{{name}}
{{{type}}} <span class='naming'>%{{name}}</span>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div>
{{{type}}} %{{name}} = <b>{{opcode}}</b> {{parameters}} {{{operands}}}
{{{type}}} <span class='naming'>%{{name}}</span> = <b>{{opcode}}</b> {{parameters}} {{{operands}}}
</div>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
%{{name}}
<span class='naming'>%{{name}}</span>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
%{{name}}
<span class='naming'>%{{name}}</span>

0 comments on commit 4b9bc30

Please sign in to comment.