Class: Wx::SF::MultiSelRect
Instance Method Summary
collapse
Methods inherited from RectShape
#create_handles, #do_begin_handle, #do_on_handle, #draw_highlighted, #draw_hover, #draw_normal, #draw_shadow, #fit_to_children, #get_border, #get_border_point, #get_bounding_box, #get_fill, #get_rect_size, #scale, #scale_rectangle, #set_border, #set_fill, #set_rect_size
Methods inherited from Shape
#accept_child, #accept_connection, #accept_currently_dragged_shapes, #accept_src_neighbour, #accept_trg_neighbour, #activate, #active?, #add_child_shape, #add_connection_point, #add_handle, #add_style, #ancestor?, #clear_accepted_childs, #clear_accepted_connections, #clear_accepted_src_neighbours, #clear_accepted_trg_neighbours, component, component_shapes, #contains?, #contains_style, #create_handles, #descendant?, #do_alignment, #does_not_accept_children?, #draw, #draw_highlighted, #draw_hover, #draw_normal, #draw_selected, #draw_shadow, #fit_to_children, #get_absolute_position, #get_accepted_children, #get_accepted_connections, #get_accepted_src_neighbours, #get_accepted_trg_neighbours, #get_assigned_connections, #get_border_point, #get_bounding_box, #get_center, #get_child_shapes, #get_children, #get_children_recursively, #get_complete_bounding_box, #get_connection_point, #get_connection_points, #get_custom_dock_point, #get_diagram, #get_grand_parent_shape, #get_h_align, #get_h_border, #get_handle, #get_handles, #get_hover_colour, #get_nearest_connection_point, #get_neighbours, #get_parent_absolute_position, #get_parent_canvas, #get_parent_shape, #get_relative_position, #get_shape_canvas, #get_style, #get_user_data, #get_v_align, #get_v_border, #has_children, #has_selected_parent?, #include_child_shape?, #inside?, #inspect, #intersects?, #is_child_accepted, #is_connection_accepted, #is_managed, #is_manager, #is_src_neighbour_accepted, #is_trg_neighbour_accepted, lines_intersection, #lines_intersection, #move_by, #move_to, #on_begin_drag, #on_child_dropped, #on_dragging, #on_end_drag, #on_import, #on_key, #on_left_click, #on_left_double_click, #on_mouse_enter, #on_mouse_leave, #on_mouse_over, #on_right_click, #on_right_double_click, #refresh, #refresh_rect, #remove_connection_point, #remove_handle, #remove_style, #scale, #scale_children, #select, #selected?, #set_custom_dock_point, #set_diagram, #set_h_align, #set_h_border, #set_hover_colour, #set_parent_shape, #set_relative_position, #set_style, #set_user_data, #set_v_align, #set_v_border, #show, #show_handles, #to_s, #update, #visible?
Constructor Details
11
12
13
14
15
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 11
def initialize
super
set_border(Wx::Pen.new(Wx::Colour.new(100, 100, 100), 1, Wx::PenStyle::PENSTYLE_DOT))
set_fill(Wx::TRANSPARENT_BRUSH)
end
|
Instance Method Details
#on_begin_handle(handle) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 20
def on_begin_handle(handle)
if get_parent_canvas
lst_shapes = get_parent_canvas.get_selected_shapes
lst_shapes.each { |shape| shape.on_begin_handle(handle) }
end
end
|
#on_bottom_handle(handle) ⇒ Object
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 153
def on_bottom_handle(handle)
if get_parent_canvas && !any_height_exceeded(handle.get_delta)
sy = (get_rect_size.y - 2*DEFAULT_ME_OFFSET + handle.get_delta.y).to_f/(get_rect_size.y - 2*DEFAULT_ME_OFFSET)
lst_selection = get_parent_canvas.get_selected_shapes
lst_selection.each do |shape|
if !shape.is_a?(LineShape)
shape.scale(1, sy, children: WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE)
if shape.has_style?(STYLE::POSITION_CHANGE)
dy = (shape.get_absolute_position.y - (get_absolute_position.y + DEFAULT_ME_OFFSET))/(get_rect_size.y - 2*DEFAULT_ME_OFFSET)*handle.get_delta.y
shape.move_by(0, dy)
end
shape.fit_to_children unless shape.has_style?(STYLE::NO_FIT_TO_CHILDREN)
else
if shape.has_style?(STYLE::POSITION_CHANGE)
shape.get_control_points.each do |cpt|
dy = (cpt.y - (get_absolute_position.y + DEFAULT_ME_OFFSET))/(get_rect_size.y - 2*DEFAULT_ME_OFFSET)*handle.get_delta.y
cpt.y += dy
cpt.y = cpt.y.floor
end
end
end
end
end
end
|
#on_end_handle(handle) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 41
def on_end_handle(handle)
if get_parent_canvas
lst_shapes = get_parent_canvas.get_selected_shapes
lst_shapes.each { |shape| shape.on_end_handle(handle) }
end
end
|
#on_handle(handle) ⇒ Object
33
34
35
36
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 33
def on_handle(handle)
super
get_parent_canvas.invalidate_visible_rect
end
|
#on_left_handle(handle) ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 85
def on_left_handle(handle)
if get_parent_canvas && !any_width_exceeded(Wx::Point.new(-handle.get_delta.x, 0))
sx = (get_rect_size.x - 2*DEFAULT_ME_OFFSET - handle.get_delta.x).to_f/(get_rect_size.x - 2*DEFAULT_ME_OFFSET)
lst_selection = get_parent_canvas.get_selected_shapes
lst_selection.each do |shape|
if !shape.is_a?(LineShape)
if shape.has_style?(STYLE::POSITION_CHANGE)
if shape.get_parent_shape
shape.set_relative_position(shape.get_relative_position.x*sx, shape.get_relative_position.y)
else
dx = handle.get_delta.x - (shape.get_absolute_position.x - (get_absolute_position.x + DEFAULT_ME_OFFSET))/(get_rect_size.x - 2*DEFAULT_ME_OFFSET)*handle.get_delta.x
shape.move_by(dx, 0)
end
end
shape.scale(sx, 1, children: WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE)
shape.fit_to_children unless shape.has_style?(STYLE::NO_FIT_TO_CHILDREN)
else
if shape.has_style?(STYLE::POSITION_CHANGE)
shape.get_control_points.each do |cpt|
dx = handle.get_delta.x - (cpt.x - (get_absolute_position.x + DEFAULT_ME_OFFSET))/(get_rect_size.x - 2*DEFAULT_ME_OFFSET)*handle.get_delta.x
cpt.x += dx
cpt.x = cpt.x.floor
end
end
end
end
end
end
|
#on_right_handle(handle) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 54
def on_right_handle(handle)
if get_parent_canvas && !any_width_exceeded(handle.get_delta)
sx = (get_rect_size.x - 2*DEFAULT_ME_OFFSET + handle.get_delta.x).to_f/(get_rect_size.x - 2*DEFAULT_ME_OFFSET)
lst_selection = get_parent_canvas.get_selected_shapes
lst_selection.each do |shape|
if !shape.is_a?(LineShape)
shape.scale(sx, 1, children: WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE)
if shape.has_style?(STYLE::POSITION_CHANGE)
dx = (shape.get_absolute_position.x - (get_absolute_position.x + DEFAULT_ME_OFFSET))/(get_rect_size.x - 2*DEFAULT_ME_OFFSET)*handle.get_delta.x
shape.move_by(dx, 0)
end
shape.fit_to_children unless shape.has_style?(STYLE::NO_FIT_TO_CHILDREN)
else
if shape.contains_style(STYLE::POSITION_CHANGE)
shape.get_control_points.each do |cpt|
dx = (cpt.x - (get_absolute_position.x + DEFAULT_ME_OFFSET))/(get_rect_size.x - 2*DEFAULT_ME_OFFSET)*handle.get_delta.x
cpt.x += dx
cpt.x = cpt.x.floor
end
end
end
end
end
end
|
#on_top_handle(handle) ⇒ Object
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/wx/shapes/shapes/multi_sel_rect.rb', line 119
def on_top_handle(handle)
if get_parent_canvas && !any_height_exceeded(Wx::Point.new(0, -handle.get_delta.y))
sy = (get_rect_size.y - 2*DEFAULT_ME_OFFSET - handle.get_delta.y).to_f/(get_rect_size.y - 2*DEFAULT_ME_OFFSET)
lst_selection = get_parent_canvas.get_selected_shapes
lst_selection.each do |shape|
if !shape.is_a?(LineShape)
if shape.has_style?(STYLE::POSITION_CHANGE)
if shape.get_parent_shape
shape.set_relative_position(shape.get_relative_position.x, shape.get_relative_position.y*sy)
else
dy = handle.get_delta.y - (shape.get_absolute_position.y - (get_absolute_position.y + DEFAULT_ME_OFFSET))/(get_rect_size.y - 2*DEFAULT_ME_OFFSET)*handle.get_delta.y
shape.move_by(0, dy)
end
end
shape.scale(1, sy, children: WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE)
shape.fit_to_children unless shape.has_style?(STYLE::NO_FIT_TO_CHILDREN)
else
if shape.has_style?(STYLE::POSITION_CHANGE)
shape.get_control_points.each do |cpt|
dy = handle.get_delta.y - (cpt.y - (get_absolute_position.y + DEFAULT_ME_OFFSET))/(get_rect_size.y - 2*DEFAULT_ME_OFFSET)*handle.get_delta.y
cpt.y += dy
cpt.y = cpt.y.floor
end
end
end
end
end
end
|