Class: Metro::UI::ModelLabel
- Defined in:
- lib/metro/models/ui/model_label.rb
Overview
The model label will draw a bounding box and label around another model
The model label is used by the model labeler which is a facet of the edit scene
Constant Summary
Constants included from Metro::Units
Instance Attribute Summary collapse
-
#target ⇒ Object
Stores the model that is currently being labeled.
Attributes inherited from Model
Instance Method Summary collapse
- #bounds=(bounds) ⇒ Object
- #draw ⇒ Object
- #draw_bounding_box ⇒ Object
- #draw_label ⇒ Object
- #label_z_order ⇒ Object
Methods inherited from Model
#_load, #_save, #after_initialize, #bounds, #create, #draw_completed?, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #show, #to_hash, #update, #update_completed?
Methods included from HasEvents
Methods included from KeyValueCoding
Methods included from PropertyOwner
Constructor Details
This class inherits a constructor from Metro::Model
Instance Attribute Details
#target ⇒ Object
Stores the model that is currently being labeled.
13 14 15 |
# File 'lib/metro/models/ui/model_label.rb', line 13 def target @target end |
Instance Method Details
#bounds=(bounds) ⇒ Object
15 16 17 18 19 |
# File 'lib/metro/models/ui/model_label.rb', line 15 def bounds=(bounds) bounding_box.position = bounds.top_left label.position = bounds.top_left + Point.at(4,2,label_z_order) label_background.position = label.position - Point.at(2,0,1) end |
#draw ⇒ Object
49 50 51 52 |
# File 'lib/metro/models/ui/model_label.rb', line 49 def draw draw_bounding_box if should_draw_bounding_box draw_label if should_draw_label end |
#draw_bounding_box ⇒ Object
54 55 56 |
# File 'lib/metro/models/ui/model_label.rb', line 54 def draw_bounding_box bounding_box.draw end |
#draw_label ⇒ Object
58 59 60 61 |
# File 'lib/metro/models/ui/model_label.rb', line 58 def draw_label label_background.draw label.draw end |
#label_z_order ⇒ Object
39 40 41 |
# File 'lib/metro/models/ui/model_label.rb', line 39 def label_z_order target.respond_to?(:z_order) ? target.z_order + 2 : 0 end |