object in register change fixed

This commit is contained in:
Torsten Ruger 2015-10-04 22:39:02 +03:00
parent d23a9846e3
commit 36e3a8d4cc
3 changed files with 14 additions and 5 deletions

View File

@ -21,7 +21,7 @@ class ListView < ElementView
# replace the child at index with the given one (second arg)
# The child must be an ElementView , which will be rendered and
# the old node will be replaces in the live dom
# the old node will be replaced in the live dom
def replace_at index , with
old = @elements[index]
@children[index] = with

View File

@ -2,6 +2,8 @@ require_relative "ref_view"
class ObjectView < ListView
# z is the z-index
def initialize object_id , interpreter = nil , z = nil
@object_id = object_id
@z = z
@ -18,11 +20,18 @@ class ObjectView < ListView
end
def object_changed reg , at
puts "Object changed in #{reg}"
at = at - 1 #take the layout off
#puts "Object changed in #{reg}"
for_object = @interpreter.get_register( reg )
return unless for_object == @object_id
puts "Object changed #{for_object} , at #{at}"
#puts "Object changed #{for_object} , at #{at}"
object = Virtual.machine.objects[@object_id]
raise "error #{@object_id} , #{at}" unless object and ! object.is_a?(String)
variable = object.get_instance_variables.get(at)
#puts "got var name #{variable} for #{at}"
f = object.get_instance_variable(variable)
element = RefView.new( variable , f.object_id , @z )
replace_at at , element
end
def class_header(id)

View File

@ -39,7 +39,7 @@ class RefView < ListView
end
def hover
puts "hovering #{@name}"
#puts "hovering #{@name}"
append_view ObjectView.new(@value)
@element.off("hover")
end