Class: Ruflet::UI::Controls::RufletComponents::MapControl
- Inherits:
-
Control
- Object
- Control
- Ruflet::UI::Controls::RufletComponents::MapControl
show all
- Defined in:
- lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb
Constant Summary
collapse
- TYPE =
"map".freeze
- WIRE =
"Map".freeze
- KEYWORDS =
Map accepts the extension's evolving property surface through
**props. An explicit empty schema keeps mruby from mistaking the
keyrest parameter itself for a property named props.
[].freeze
Constants inherited
from Control
Control::HOST_EXPANDED_TYPES, Control::SCHEMA_METADATA_CACHE
Instance Attribute Summary
Attributes inherited from Control
#children, #id, #props, #runtime_page, #type, #wire_id
Instance Method Summary
collapse
Methods inherited from Control
#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch
Constructor Details
#initialize(id: nil, **props) ⇒ MapControl
Returns a new instance of MapControl.
15
16
17
18
19
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 15
def initialize(id: nil, **props)
mapped = props.dup
mapped[:initial_center] = normalize_coordinates(mapped[:initial_center]) if mapped.key?(:initial_center)
super(type: TYPE, id: id, **mapped)
end
|
Instance Method Details
#center_on(point, zoom: nil, **options) ⇒ Object
53
54
55
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 53
def center_on(point, zoom: nil, **options)
invoke_map("center_on", options.merge(point: normalize_coordinates(point), zoom: zoom))
end
|
#move_to(destination: nil, zoom: nil, rotation: nil, offset: nil, **options) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 41
def move_to(destination: nil, zoom: nil, rotation: nil, offset: nil, **options)
invoke_map(
"move_to",
options.merge(
destination: normalize_coordinates(destination),
zoom: zoom,
rotation: rotation,
offset: offset
)
)
end
|
#reset_rotation(**options) ⇒ Object
25
26
27
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 25
def reset_rotation(**options)
invoke_map("reset_rotation", options)
end
|
#rotate_from(degree, **options) ⇒ Object
21
22
23
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 21
def rotate_from(degree, **options)
invoke_map("rotate_from", options.merge(degree: degree))
end
|
#zoom_in(**options) ⇒ Object
29
30
31
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 29
def zoom_in(**options)
invoke_map("zoom_in", options)
end
|
#zoom_out(**options) ⇒ Object
33
34
35
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 33
def zoom_out(**options)
invoke_map("zoom_out", options)
end
|
#zoom_to(zoom, **options) ⇒ Object
37
38
39
|
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb', line 37
def zoom_to(zoom, **options)
invoke_map("zoom_to", options.merge(zoom: zoom))
end
|