Class: AMS::SketchupObserver Abstract

Inherits:
Object
  • Object
show all
Defined in:
docs/ams/sketchup_observer.rb

Overview

This class is abstract.
Note:

SWO events are capable of monitoring window events. SWP, in addition to monitoring, are capable to making decisions to the window events. Returning 1 for an SWP event will prevent the event from reaching the SketchUp window procedure; any other return value does not block the event. If more than one observers utilize a common SWP event and one of them returns 1, the event will be blocked, regardless of whether other observers wanted the event to be processed by the SketchUp window procedure.

Note:

An observer can be a class, a module, or a class instance. Your observer will work as long as the callback methods are public.

Note:

Including all observer methods into your class is not necessary. You may include/elude those as you wish.

Note:

Windows only!

SketchUpObserver allows monitoring and making decisions to the input events and messages reaching the SketchUp window procedure.

Examples:

Processing keyboard events:

class MySketchupObserver

  def swp_on_key_down(vk_name, vk_value, vk_char)
    puts "on_key_down: #{vk_name}"
    # ...
    # Returning 1 will prevent current pressed key from interacting with SU
    # window procedure.
    # Here, we'll return 1 to W,S,A,D keys, so we could use them for our own
    # purpose, rather than having shortcuts changing the tool.
    focused = AMS::Sketchup.is_viewport_focused? # ensure that only an active view blocks
    return focused && %(w s a d).include?(vk_name) ? 1 : 0
  end

  def swp_on_key_extended(vk_name, vk_value, vk_char)
    puts "on_key_extended: #{vk_name}"
    # ...
    # If you return 1 for the on_key_down event, it's also preferred to
    # return 1 for the on_key_extended event, so the key doesn't stand a
    # chance to interact with SketchUp window procedure.
    focused = AMS::Sketchup.is_viewport_focused? # ensure that only an active view blocks
    return focused && %(w s a d).include?(vk_name) ? 1 : 0
  end

  def swp_on_key_up(vk_name, vk_value, vk_char)
    puts "on_key_up: #{vk_name}"
    # ...
    # If you return 1 for the on_key_down event, it's also preferred to
    # return 1 for the on_key_up event, so the key doesn't stand a chance to
    # interact with SketchUp window procedure.
    focused = AMS::Sketchup.is_viewport_focused? # ensure that only an active view blocks
    return focused && %(w s a d).include?(vk_name) ? 1 : 0
  end

end # class MySketchupObserver

AMS::Sketchup.add_observer(MySketchupObserver.new)

See Also:

Since:

  • 2.0.0

Observer Events collapse

Mouse Input Events collapse

Keyboard Input Events collapse

SketchUp Window Events collapse

SketchUp Window Post Events collapse

Instance Method Details

#swo_activateObject

Called whenever this observer is added.

Since:

  • 2.0.0

#swo_deactivateObject

Called whenever this observer is removed.

Since:

  • 2.0.0

#swo_error(e) ⇒ Object

Note:

An error will not force the observer to deactivate. If you want the observer to deactivate on error, then this is the observer method implement.

Note:

If this event is not implemented, by default, the error will be outputted in console.

Note:

If there is an error in this event, the error message will be outputted in console.

Triggered whenever there is an error in any of the observer methods, with exception to this, particular observer method.

Examples:

Deactivating an observer when an error occurs.

class MyMouseWheelObserver

  def swp_on_mouse_wheel_rotate(x, y, dir)
    puts "Mouse wheel rotated #{dir == 1 ? 'up' : 'down'}!"
    # 'yo' is undefined. Make this error on purpose.
    yo
  end

  def swo_error(e)
    puts e.message
    # Deactivate our observer
    AMS::Sketchup.remove_observer(self)
  end

end # class MyMouseWheelObserver

AMS::Sketchup.add_observer(MyMouseWheelObserver.new)
# In this example, after adding an observer and rotating a mouse wheel,
# which would trigger the swp_on_mouse_wheel_rotate event, the undefined
# 'yo', which is in the swp_on_mouse_wheel_rotate event, will throw an
# exception, which would be caught by the swo_error event. The swo_error
# event will output the error message into console and unregister the
# current observer.

Parameters:

  • e (Exception)

Since:

  • 2.0.0

#swo_on_blurObject

Called when main window is deactivated.

Since:

  • 2.0.0

#swo_on_caption_changed(text) ⇒ Object

Called when main window title text is changed.

Parameters:

  • text (String)

    New text

Since:

  • 2.0.0

#swo_on_enter_menuObject

Called when application enters the menu loop.

Since:

  • 2.0.0

#swo_on_enter_size_move(x, y, w, h) ⇒ Object

Called when main window enters the state of being sized and/or moved.

Parameters:

  • x (Integer)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Integer)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Integer)

    Window width in pixels.

  • h (Integer)

    Window height in pixels.

Since:

  • 2.0.0

#swo_on_exit_menuObject

Called when application exits the menu loop.

Since:

  • 2.0.0

#swo_on_exit_size_move(x, y, w, h) ⇒ Object

Called when main window exits the state of being sized and/or moved.

Parameters:

  • x (Integer)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Integer)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Integer)

    Window width in pixels.

  • h (Integer)

    Window height in pixels.

Since:

  • 2.0.0

#swo_on_focusObject

Called when main window is activated.

Since:

  • 2.0.0

#swo_on_maximizeObject

Called when main window is maximized.

Since:

  • 2.0.0

#swo_on_menu_bar_changed(state) ⇒ Object

Called when main window menu bar is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the menu bar is set; a false value indicates the menu bar is removed.

Since:

  • 2.0.0

#swo_on_minimizeObject

Called when main window is minimized.

Since:

  • 2.0.0

#swo_on_page_selected(page1, page2, tab_index1, tab_index2) ⇒ Object

Note:

Two additional parameters, tab_index1 and tab_index2, were added in 3.5.0.

Called when a scenes page is selected.

Parameters:

  • page1 (Sketchup::Page)

    Originally selected page.

  • page2 (Sketchup::Page)

    New selected page.

  • tab_index1 (Integer)
  • tab_index2 (Integer)

Since:

  • 3.2.0

#swo_on_post_blurObject

Called after main window is deactivated.

Since:

  • 3.0.0

#swo_on_post_caption_changed(text) ⇒ Object

Called after main window title text is changed.

Parameters:

  • text (String)

    New text

Since:

  • 3.0.0

#swo_on_post_enter_menuObject

Called after application enters the menu loop.

Since:

  • 3.0.0

#swo_on_post_enter_size_move(x, y, w, h) ⇒ Object

Called after main window enters the state of being sized and/or moved.

Parameters:

  • x (Integer)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Integer)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Integer)

    Window width in pixels.

  • h (Integer)

    Window height in pixels.

Since:

  • 3.0.0

#swo_on_post_exit_menuObject

Called after application exits the menu loop.

Since:

  • 3.0.0

#swo_on_post_exit_size_move(x, y, w, h) ⇒ Object

Called after main window exits the state of being sized and/or moved.

Parameters:

  • x (Integer)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Integer)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Integer)

    Window width in pixels.

  • h (Integer)

    Window height in pixels.

Since:

  • 3.0.0

#swo_on_post_focusObject

Called after main window is activated.

Since:

  • 3.0.0

#swo_on_post_maximizeObject

Called after main window is maximized.

Since:

  • 3.0.0

#swo_on_post_menu_bar_changed(state) ⇒ Object

Called after main window menu bar is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the menu bar is set; a false value indicates the menu bar is removed.

Since:

  • 3.0.0

#swo_on_post_minimizeObject

Called after main window is minimized.

Since:

  • 3.0.0

#swo_on_post_restoreObject

Called after main window is set to normal placement.

Since:

  • 3.0.0

#swo_on_post_scenes_bar_emptiedObject

Called after scenes bar loses its last page.

Since:

  • 3.0.0

#swo_on_post_scenes_bar_filledObject

Called after scenes bar gets its first page.

Since:

  • 3.0.0

#swo_on_post_scenes_bar_visibility_changed(state) ⇒ Object

Called after scenes bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates scenes bar is set visible; a false value indicates scenes bar is set hidden.

Since:

  • 3.0.0

#swo_on_post_size_move(x, y, w, h) ⇒ Object

Called after main window is being sized and/or moved.

Parameters:

  • x (Integer)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Integer)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Integer)

    Window width in pixels.

  • h (Integer)

    Window height in pixels.

Since:

  • 3.0.0

#swo_on_post_status_bar_visibility_changed(state) ⇒ Object

Called after status bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates status bar is set visible; a false value indicates status bar is set hidden.

Since:

  • 3.0.0

#swo_on_post_switch_full_screen(state) ⇒ Object

Called after main window is switched to/from full screen mode.

Parameters:

  • state (Boolean)

    A true value indicates the window is set full screen; a false value indicated the window is unset from full screen mode.

Since:

  • 3.0.0

#swo_on_post_toolbar_container_emptied(bar) ⇒ Object

Called after toolbar container is emptied.

Parameters:

  • bar (Integer)

    A container which was emptied. It can be one of the following values:

    1. top bar
    2. bottom bar
    3. left bar
    4. right bar

Since:

  • 3.0.0

#swo_on_post_toolbar_container_filled(bar) ⇒ Object

Called after toolbar container is filled.

Parameters:

  • bar (Integer)

    A container which was filled. It can be one of the following values:

    1. top bar
    2. bottom bar
    3. left bar
    4. right bar

Since:

  • 3.0.0

#swo_on_post_toolbar_container_visibility_changed(bar, state) ⇒ Object

Called after toolbar container is shown or hidden.

Parameters:

  • bar (Integer)

    A container which visibility state was changed. It can be one following values:

    1. top bar
    2. bottom bar
    3. left bar
    4. right bar
  • state (Boolean)

    A true value indicates toolbar container is set visible; a false value indicates toolbar container is set hidden.

Since:

  • 3.0.0

#swo_on_post_viewport_border_changed(state) ⇒ Object

Called after view border, a thin edge surrounding the view, is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the edge is set; a false value indicates the edge is removed.

Since:

  • 3.0.0

#swo_on_post_viewport_size(w, h) ⇒ Object

Called after the view window is sized.

Parameters:

  • w (Integer)

    View width in pixels.

  • h (Integer)

    View height in pixels.

Since:

  • 3.0.0

#swo_on_quitObject

Called right before SketchUp window is destroyed.

Since:

  • 2.0.0

#swo_on_restoreObject

Called when main window is set to normal placement.

Since:

  • 2.0.0

#swo_on_scenes_bar_emptiedObject

Called when scenes bar loses its last page.

Since:

  • 2.0.0

#swo_on_scenes_bar_filledObject

Called when scenes bar gets its first page.

Since:

  • 2.0.0

#swo_on_scenes_bar_visibility_changed(state) ⇒ Object

Called when scenes bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates scenes bar is set visible; a false value indicates scenes bar is set hidden.

Since:

  • 2.0.0

#swo_on_size_move(x, y, w, h) ⇒ Object

Called when main window is being sized and/or moved.

Parameters:

  • x (Integer)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Integer)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Integer)

    Window width in pixels.

  • h (Integer)

    Window height in pixels.

Since:

  • 2.0.0

#swo_on_status_bar_visibility_changed(state) ⇒ Object

Called when status bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates status bar is set visible; a false value indicates status bar is set hidden.

Since:

  • 2.0.0

#swo_on_switch_full_screen(state) ⇒ Object

Called when main window is switched to/from full screen mode.

Parameters:

  • state (Boolean)

    A true value indicates the window is set full screen; a false value indicated the window is unset from full screen mode.

Since:

  • 2.0.0

#swo_on_toolbar_container_emptied(bar) ⇒ Object

Called when toolbar container is emptied.

Parameters:

  • bar (Integer)

    A container which was emptied. It can be one of the following values:

    1. top bar
    2. bottom bar
    3. left bar
    4. right bar

Since:

  • 2.0.0

#swo_on_toolbar_container_filled(bar) ⇒ Object

Called when toolbar container is filled.

Parameters:

  • bar (Integer)

    A container which was filled. It can be one of the following values:

    1. top bar
    2. bottom bar
    3. left bar
    4. right bar

Since:

  • 2.0.0

#swo_on_toolbar_container_visibility_changed(bar, state) ⇒ Object

Called when toolbar container is shown or hidden.

Parameters:

  • bar (Integer)

    A container which visibility state was changed. It can be one following values:

    1. top bar
    2. bottom bar
    3. left bar
    4. right bar
  • state (Boolean)

    A true value indicates toolbar container is set visible; a false value indicates toolbar container is set hidden.

Since:

  • 2.0.0

#swo_on_user_message(sender_handle, id, user_data) ⇒ Object

Called when a user-sent message is received.

Parameters:

  • sender_handle (Integer)

    A handle to a SketchUp main window that sent a message.

  • id (Integer)

    A user-defined unique message identifier sent along with a message.

  • user_data (nil, Boolean, Integer, Bignum, Float, String, Symbol, Hash)

    User-defined information or data sent along with a message.

See Also:

Since:

  • 3.1.0

#swo_on_viewport_border_changed(state) ⇒ Object

Called when view border, a thin edge surrounding the view, is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the edge is set; a false value indicates the edge is removed.

Since:

  • 2.0.0

#swo_on_viewport_size(w, h) ⇒ Object

Called when the view window is sized.

Parameters:

  • w (Integer)

    View width in pixels.

  • h (Integer)

    View height in pixels.

Since:

  • 2.0.0

#swp_on_command(id) ⇒ Integer

Note:

Since version 3.1.0, this event no longer triggers on 24214 command.

Called when SketchUp window procedure comes across the WM_COMMAND message. This event responds to Sketchup.send_action, as it too, generates WM_COMMAND messages. This event is usually called when a tool is activated.

Parameters:

  • id (Integer)

    Command identifier

Returns:

  • (Integer)

    A return value of 1 will prevent the command from reaching SketchUp window procedure; any other return value won't block the command.

Since:

  • 2.0.0

#swp_on_key_down(vk_name, vk_value, vk_char) ⇒ Integer

Note:

Returning 1 for this event prvents the consequent #swp_on_key_extended and #swp_on_key_up events from being called.

Called when key is pressed.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Integer)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Integer)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0

#swp_on_key_extended(vk_name, vk_value, vk_char) ⇒ Integer

Called when key is held down.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Integer)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Integer)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0

#swp_on_key_up(vk_name, vk_value, vk_char) ⇒ Integer

Called when key is released.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Integer)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Integer)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0

#swp_on_lbutton_double_click(x, y) ⇒ Integer

Called when left mouse button is double clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_lbutton_down(x, y) ⇒ Integer

Called when left mouse button is clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_lbutton_up(x, y) ⇒ Integer

Called when left mouse button is released.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_mbutton_double_click(x, y) ⇒ Integer

Called when middle mouse button is double clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_mbutton_down(x, y) ⇒ Integer

Called when middle mouse button is clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_mbutton_up(x, y) ⇒ Integer

Called when middle mouse button is released.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_mouse_enter(x, y) ⇒ Integer

Called when cursor enters the viewport client area.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.6.0

#swp_on_mouse_leave(x, y) ⇒ Integer

Called when cursor leaves the viewport client area.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.6.0

#swp_on_mouse_move(x, y) ⇒ Integer

Note:

Returning 1 doesn't prevent the mouse from moving, but it does prevent the cursor position change event from being sent to the viewport window.

Called when cursor is moved within the viewport client area.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.6.0

#swp_on_mouse_wheel_rotate(x, y, dir) ⇒ Integer

Called when mouse wheel is rotated.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

  • dir (Integer)

    A positive value (1) indicates that the wheel was rotated forward, away from the user; a negative value (-1) indicates that the wheel was rotated backward, toward the user.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_mouse_wheel_tilt(x, y, dir) ⇒ Integer

Called when mouse wheel is tilted.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

  • dir (Integer)

    A positive value (1) indicates that the wheel was tilted right; a negative value (-1) indicates that the wheel was tilted left.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_page_selected(page1, page2, tab_index1, tab_index2) ⇒ Integer

Note:

Unlike the #swo_on_page_selected, this callback function allows preventing the activation of a page and is triggered only when the page is activated via selecting it from the scenes bar. Activating a page in any other way, through the API for instance, will not trigger this event.

Note:

This event is useful for creating custom scene transitions.

Called when a scenes page is selected.

Examples:

Activate scene tab without activating the associated page.

class MySWPObserver
  def swp_on_page_selected(page1, page2, tab_index1, tab_index2)
    AMS::Sketchup.activate_scenes_bar_tab(tab_index2)
    return 1
  end
end
AMS::Sketchup.add_observer(MySWPObserver.new)

Parameters:

  • page1 (Sketchup::Page)

    Originally selected page.

  • page2 (Sketchup::Page)

    New selected page.

  • tab_index1 (Integer)
  • tab_index2 (Integer)

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.5.0

#swp_on_rbutton_down(x, y) ⇒ Integer

Called when right mouse button is clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_rbutton_up(x, y) ⇒ Integer

Called when right mouse button is released.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_xbutton1_double_click(x, y) ⇒ Integer

Called when X mouse button 1 is double clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_xbutton1_down(x, y) ⇒ Integer

Called when X mouse button 1 is clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_xbutton1_up(x, y) ⇒ Integer

Called when X mouse button 1 is released.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_xbutton2_double_click(x, y) ⇒ Integer

Called when X mouse button 2 is double clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_xbutton2_down(x, y) ⇒ Integer

Called when X mouse button 2 is clicked.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0

#swp_on_xbutton2_up(x, y) ⇒ Integer

Called when X mouse button 2 is released.

Parameters:

  • x (Integer)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Integer)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Integer)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0