Class: RuboCop::Cop::SketchupSuggestions::ToolInvalidate
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::SketchupSuggestions::ToolInvalidate
- Includes:
- SketchUp::ToolChecker
- Defined in:
- lib/rubocop/sketchup/cop/suggestions/tool_invalidate.rb
Overview
After having drawn to the viewport from a tool, make sure to invalidate the view on ‘deactivate` and `suspend`.
If you don’t do that the things you drew might stick around for longer than the life-span of the tool and cause confusion for the user.
Constant Summary collapse
- MSG_MISSING_INVALIDATE_METHOD =
'When drawing to the viewport, make '\ 'sure to `suspend` and `deactivate` calls `view.invalidate`.'
- MSG_MISSING_INVALIDATE =
'When drawing to the viewport, make sure to '\ 'call `view.invalidate` when the tool becomes inactive.'
Instance Method Summary collapse
Methods included from SketchUp::ToolChecker
Instance Method Details
#on_tool_class(class_node, body_methods) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/rubocop/sketchup/cop/suggestions/tool_invalidate.rb', line 43 def on_tool_class(class_node, body_methods) return unless find_method(body_methods, :draw) check_method_invalidate(:deactivate, body_methods, class_node) check_method_invalidate(:suspend, body_methods, class_node) end |