lib/wx/shapes/shapes/multi_sel_rect.rb in wxruby3-shapes-0.9.0.pre.beta.3 vs lib/wx/shapes/shapes/multi_sel_rect.rb in wxruby3-shapes-0.9.5

- old
+ new

@@ -58,11 +58,11 @@ lst_selection = get_parent_canvas.get_selected_shapes lst_selection.each do |shape| # scale main parent shape if !shape.is_a?(LineShape) - shape.scale(sx, 1, WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE) + 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) @@ -88,19 +88,19 @@ 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.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, WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE) + 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 @@ -130,11 +130,11 @@ 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, WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE) + 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 @@ -151,16 +151,16 @@ # The function can be overridden if necessary. # @param handle Reference to dragged shape handle 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, WITHCHILDREN) if shape.has_style?(STYLE::SIZE_CHANGE) + 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) @@ -185,11 +185,11 @@ def any_width_exceeded(delta) if get_parent_canvas lst_selection = get_parent_canvas.get_selected_shapes # determine whether any shape in the selection exceeds its bounds lst_selection.each do |shape| - return true if !shape.is_a?(LineShape) && (shape.get_bounding_box.width + delta.x) <= 1 + return true if !shape.is_a?(LineShape) && (shape.get_bounding_box.width + delta.x) < 1 end return false end true end @@ -200,10 +200,10 @@ def any_height_exceeded(delta) if get_parent_canvas lst_selection = get_parent_canvas.get_selected_shapes # determine whether any shape in the selection exceeds its bounds lst_selection.each do |shape| - return true if !shape.is_a?(LineShape) && (shape.get_bounding_box.height + delta.y) <= 1 + return true if !shape.is_a?(LineShape) && (shape.get_bounding_box.height + delta.y) < 1 end return false end true end