indexing description: "[ Zoom Tool ]" date: "$Date$" revision: "$Revision$" class ZOOM_TOOL inherit TOOL create make feature -- Access cursor: MOUSE_CURSOR is -- appropriate cursor do if scene.focus_on_scene then Result := zoom_cursor else Result := arrow_cursor end end feature -- Event Handling handle_mouse_button_down_event (event: EM_MOUSEBUTTON_EVENT) is -- Handle mouse button down event. local vec: EM_VECTOR_2D new_scaling_factor: DOUBLE do if event.is_left_button and scene.scale < max_scale and scene.focus_on_scene then vec := transform_position (event.x, event.y) scene.set_center (vec.x.rounded, vec.y.rounded) scene.set_scale (scene.scale * scaling_factor) new_scaling_factor := scene.scale elseif event.is_right_button and scene.scale > min_scale and scene.focus_on_scene then vec := transform_position (event.x, event.y) scene.set_center (vec.x.rounded, vec.y.rounded) scene.set_scale (scene.scale / scaling_factor) new_scaling_factor := scene.scale end if new_scaling_factor > 0 then -- a new scaling factor was set, update image_scaled from scene.image_panes.start until scene.image_panes.off loop scene.image_panes.item_for_iteration.generate_image_scaled (new_scaling_factor) scene.image_panes.forth end end end handle_mouse_button_up_event (event: EM_MOUSEBUTTON_EVENT) is -- Handle mouse button up event. do end handle_mouse_motion_event (event: EM_MOUSEMOTION_EVENT) is -- Handle mouse motion event. do end handle_key_down_event (event: EM_KEYBOARD_EVENT) is -- Handle key down event. do end handle_key_up_event (event: EM_KEYBOARD_EVENT) is -- Handle key up event. do end feature {NONE} -- Implementation scaling_factor: DOUBLE is 1.5 -- factor by which the scene is scaled for each click min_scale: DOUBLE is 0.01 -- minimal scale factor max_scale: DOUBLE is 10.0 -- maximal scale factor end