thomthom / SKUI

Ruby wrapper of classes that maps to GUI controls in SketchUp's UI::WebDialogs
MIT License
26 stars 14 forks source link

Add .rect property to Control #18

Closed thomthom closed 11 years ago

thomthom commented 11 years ago

Add .rect property to Control class which gives access to the position and size as given in the WebDialog.

Because currently the position and size properties can be nil - which means the property is not defined in CSS and it will get default values from the HTML engine.

Say for instance one want to anchor a control to the bottom right corner of its parent - then left and top will be nil, but it can be useful to know the left and top position after anchoring the control. This is where .rect comes in.

class Rect
  attr( :left, :top, :right, :bottom )
  attr( :width, :height )
end

Each of these attributes should be a method that queries the WebDialog for these values. Return nil or raise an error if the WebDialog is not visible or ready.