DragTool.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*************************************************************************************************\
  2. DragTool.cpp : Implementation of the DragTool component.
  3. //---------------------------------------------------------------------------//
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. //===========================================================================//
  6. \*************************************************************************************************/
  7. #include "DragTool.h"
  8. #include "EditorInterface.h"
  9. DragTool::DragTool()
  10. {
  11. lastX = lastY = -1;
  12. }
  13. //-------------------------------------------------------------------------------------------------
  14. DragTool::~DragTool()
  15. {
  16. }
  17. bool DragTool::beginPaint()
  18. {
  19. lastX = lastY = -1;
  20. return true;
  21. }
  22. Action* DragTool::endPaint()
  23. {
  24. return NULL;
  25. }
  26. bool DragTool::paint( Stuff::Vector3D& worldPos, int screenX, int screenY )
  27. {
  28. if ( lastX != -1 )
  29. {
  30. eye->moveLeft( (screenX - lastX)/eye->getScaleFactor() );
  31. eye->moveDown( (lastY - screenY)/eye->getScaleFactor() );
  32. EditorInterface::instance()->syncScrollBars();
  33. EditorInterface::instance()->SafeRunGameOSLogic();
  34. }
  35. lastX = screenX;
  36. lastY = screenY;
  37. return true;
  38. }
  39. //*************************************************************************************************
  40. // end of file ( DragTool.cpp )