Class: Sketchup::ViewObserver

Inherits:
Object
  • Object
show all

Overview

This observer interface is implemented to react to view events. To implement this observer, create a Ruby class of this type, override the desired methods, and add an instance of the observer to the view object.

Examples:

# This is an example of an observer that watches tool interactions.
class MyViewObserver < Sketchup::ViewObserver
  def onViewChanged(view)
    puts "onViewChanged: #{view}"
  end
end

# Attach the observer.
Sketchup.active_model.active_view.add_observer(MyViewObserver.new)

Version:

  • SketchUp 6.0

Instance Method Summary # collapse

Instance Method Details

#onViewChanged(view) ⇒ nil

The #onViewChanged method is called whenever the view is altered, such as when the user uses the Pan, Orbit, or Zoom tools are used.

Examples:

def onViewChanged(view)
  puts "onViewChanged: #{view}"
end

Parameters:

Returns:

  • (nil)

Version:

  • SketchUp 6.0

Known Bugs:

  • Prior to SketchUp 2019.2 this event did not trigger when the viewport size changed.