Perhaps you can follow this logic:
module Dezmo
module DezmoTest
class DezmoTestTool
def initialize
@in_transform = false
@myselection = nil
end
def onCancel(reason, view)
view.model.abort_operation if @in_transform
@in_transform = false
end
def onLButtonDown( flags, x, y, view )
if @in_transform
commit_transform(view)
else
if @myselection
start_transform( view, "My Rotation" )
else
# code for select the entities to rotate
# and set @myselection
end
end
end
def onMouseMove(flags, x, y, view)
if @in_transform && @myselection
# code for trasnform (rotate) the entities (@myselection)
else
# code for select the entities to rotate
# and set @myselection
end
end
def start_transform( view, undo_text )
@in_transform = true
#view.model.start_operation(undo_text, true)
# edited:
view.model.start_operation(undo_text)
end
def commit_transform( view )
@in_transform = false
view.model.commit_operation
end
end #tool
end #extension
end #namespace