Class: Three::Controls::OrbitControls
- Inherits:
-
Object
- Object
- Three::Controls::OrbitControls
- Defined in:
- lib/three/controls/orbit_controls.rb
Constant Summary collapse
- PROPERTY_NAMES =
{ enabled: "enabled", enable_damping: "enableDamping", damping_factor: "dampingFactor", enable_zoom: "enableZoom", zoom_speed: "zoomSpeed", enable_rotate: "enableRotate", rotate_speed: "rotateSpeed", enable_pan: "enablePan", pan_speed: "panSpeed", auto_rotate: "autoRotate", auto_rotate_speed: "autoRotateSpeed", min_distance: "minDistance", max_distance: "maxDistance", min_zoom: "minZoom", max_zoom: "maxZoom" }.freeze
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#dom_element ⇒ Object
readonly
Returns the value of attribute dom_element.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #dispose ⇒ Object
-
#initialize(object, renderer: nil, dom_element: nil, backend: nil, **parameters) ⇒ OrbitControls
constructor
A new instance of OrbitControls.
- #update ⇒ Object
Constructor Details
#initialize(object, renderer: nil, dom_element: nil, backend: nil, **parameters) ⇒ OrbitControls
Returns a new instance of OrbitControls.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/three/controls/orbit_controls.rb', line 30 def initialize(object, renderer: nil, dom_element: nil, backend: nil, **parameters) @object = object @renderer = renderer @backend = backend || renderer&.backend || Backends::ThreeJS.new @dom_element = dom_element || default_dom_element(renderer) @target = Vector3.new bind_target_changes set_defaults object_handle = @backend.sync(object) @handle = @backend.create_orbit_controls(object_handle, @dom_element) set_values(parameters) end |
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
27 28 29 |
# File 'lib/three/controls/orbit_controls.rb', line 27 def backend @backend end |
#dom_element ⇒ Object (readonly)
Returns the value of attribute dom_element.
27 28 29 |
# File 'lib/three/controls/orbit_controls.rb', line 27 def dom_element @dom_element end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
27 28 29 |
# File 'lib/three/controls/orbit_controls.rb', line 27 def handle @handle end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
27 28 29 |
# File 'lib/three/controls/orbit_controls.rb', line 27 def object @object end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
27 28 29 |
# File 'lib/three/controls/orbit_controls.rb', line 27 def renderer @renderer end |
#target ⇒ Object
Returns the value of attribute target.
27 28 29 |
# File 'lib/three/controls/orbit_controls.rb', line 27 def target @target end |
Instance Method Details
#dispose ⇒ Object
50 51 52 53 |
# File 'lib/three/controls/orbit_controls.rb', line 50 def dispose @backend.dispose_controls(@handle) self end |
#update ⇒ Object
44 45 46 47 48 |
# File 'lib/three/controls/orbit_controls.rb', line 44 def update @backend.update_controls(@handle) @backend.sync_object_transform_from_handle(@object) self end |