Browse Source

Applied window fixed resizing patch from Sebastian Delatorre.

Lasse Öörni 12 years ago
parent
commit
f7ac7eb713
3 changed files with 16 additions and 13 deletions
  1. 2 1
      Docs/Urho3D.dox
  2. 1 0
      Readme.txt
  3. 13 12
      Source/Engine/UI/Window.cpp

+ 2 - 1
Docs/Urho3D.dox

@@ -54,6 +54,7 @@ Urho3D development, contributions and bugfixes by:
 - Colin Barrett
 - Erik Beran
 - Carlo Carollo
+- Sebastian Delatorre
 - Chris Friesen
 - Alex Fuller
 - Mika Heinonen
@@ -144,7 +145,7 @@ V1.23
 - Switched to GLEW library for OpenGL extension handling.
 - Vegetation and lightmapping example shaders.
 - %Engine configuration through a parameter map.
-- Lots of refactoring, code cleanup and bugfixes.'
+- Lots of refactoring, code cleanup and bugfixes.
 
 V1.22
 

+ 1 - 0
Readme.txt

@@ -15,6 +15,7 @@ Urho3D development, contributions and bugfixes by:
 - Colin Barrett
 - Erik Beran
 - Carlo Carollo
+- Sebastian Delatorre
 - Chris Friesen
 - Alex Fuller
 - Mika Heinonen

+ 13 - 12
Source/Engine/UI/Window.cpp

@@ -142,6 +142,7 @@ void Window::OnDragMove(const IntVector2& position, const IntVector2& screenPosi
 
     IntVector2 delta = screenPosition - dragBeginCursor_;
     IntVector2 dragSize;
+    IntVector2 resizeBorderSize(resizeBorder_.left_ + resizeBorder_.right_, resizeBorder_.top_ + resizeBorder_.bottom_);
 
     const IntVector2& position_ = GetPosition();
     const IntVector2& size_ = GetSize();
@@ -158,50 +159,50 @@ void Window::OnDragMove(const IntVector2& position, const IntVector2& screenPosi
         SetPosition(Clamp(dragBeginPosition_.x_ + delta.x_, position_.x_ - (maxSize_.x_ - size_.x_), position_.x_ + (size_.x_ - minSize_.x_)),
             Clamp(dragBeginPosition_.y_ + delta.y_, position_.y_ - (maxSize_.y_ - size_.y_), position_.y_ + (size_.y_ - minSize_.y_)));
         dragSize = dragBeginSize_ - delta;
-        fixedWidthResizing_ ? SetFixedWidth(dragSize.x_) : SetWidth(dragSize.x_);
-        fixedHeightResizing_ ? SetFixedHeight(dragSize.y_) : SetHeight(dragSize.y_);
+        fixedWidthResizing_ ? SetFixedWidth(Max(dragSize.x_, resizeBorderSize.x_)) : SetWidth(dragSize.x_);
+        fixedHeightResizing_ ? SetFixedHeight(Max(dragSize.y_, resizeBorderSize.y_)) : SetHeight(dragSize.y_);
         break;
 
     case DRAG_RESIZE_TOP:
         SetPosition(dragBeginPosition_.x_, Clamp(dragBeginPosition_.y_ + delta.y_, position_.y_ - (maxSize_.y_ - size_.y_), position_.y_ + (size_.y_ - minSize_.y_)));
         dragSize = IntVector2(dragBeginSize_.x_, dragBeginSize_.y_ - delta.y_);
-        fixedHeightResizing_ ? SetFixedHeight(dragSize.y_) : SetHeight(dragSize.y_);
+        fixedHeightResizing_ ? SetFixedHeight(Max(dragSize.y_, resizeBorderSize.y_)) : SetHeight(dragSize.y_);
         break;
 
     case DRAG_RESIZE_TOPRIGHT:
         SetPosition(dragBeginPosition_.x_, dragBeginPosition_.y_ + delta.y_);
         dragSize = IntVector2(dragBeginSize_.x_ + delta.x_, dragBeginSize_.y_ - delta.y_);
-        fixedWidthResizing_ ? SetFixedWidth(dragSize.x_) : SetWidth(dragSize.x_);
-        fixedHeightResizing_ ? SetFixedHeight(dragSize.y_) : SetHeight(dragSize.y_);
+        fixedWidthResizing_ ? SetFixedWidth(Max(dragSize.x_, resizeBorderSize.x_)) : SetWidth(dragSize.x_);
+        fixedHeightResizing_ ? SetFixedHeight(Max(dragSize.y_, resizeBorderSize.y_)) : SetHeight(dragSize.y_);
         break;
 
     case DRAG_RESIZE_RIGHT:
         dragSize = IntVector2(dragBeginSize_.x_ + delta.x_, dragBeginSize_.y_);
-        fixedWidthResizing_ ? SetFixedWidth(dragSize.x_) : SetWidth(dragSize.x_);
+        fixedWidthResizing_ ? SetFixedWidth(Max(dragSize.x_, resizeBorderSize.x_)) : SetWidth(dragSize.x_);
         break;
 
     case DRAG_RESIZE_BOTTOMRIGHT:
         dragSize = dragBeginSize_ + delta;
-        fixedWidthResizing_ ? SetFixedWidth(dragSize.x_) : SetWidth(dragSize.x_);
-        fixedHeightResizing_ ? SetFixedHeight(dragSize.y_) : SetHeight(dragSize.y_);
+        fixedWidthResizing_ ? SetFixedWidth(Max(dragSize.x_, resizeBorderSize.x_)) : SetWidth(dragSize.x_);
+        fixedHeightResizing_ ? SetFixedHeight(Max(dragSize.y_, resizeBorderSize.y_)) : SetHeight(dragSize.y_);
         break;
 
     case DRAG_RESIZE_BOTTOM:
         dragSize = IntVector2(dragBeginSize_.x_, dragBeginSize_.y_ + delta.y_);
-        fixedHeightResizing_ ? SetFixedHeight(dragSize.y_) : SetHeight(dragSize.y_);
+        fixedHeightResizing_ ? SetFixedHeight(Max(dragSize.y_, resizeBorderSize.y_)) : SetHeight(dragSize.y_);
         break;
 
     case DRAG_RESIZE_BOTTOMLEFT:
         SetPosition(Clamp(dragBeginPosition_.x_ + delta.x_, position_.x_ - (maxSize_.x_ - size_.x_), position_.x_ + (size_.x_ - minSize_.x_)), dragBeginPosition_.y_);
         dragSize = IntVector2(dragBeginSize_.x_ - delta.x_, dragBeginSize_.y_ + delta.y_);
-        fixedWidthResizing_ ? SetFixedWidth(dragSize.x_) : SetWidth(dragSize.x_);
-        fixedHeightResizing_ ? SetFixedHeight(dragSize.y_) : SetHeight(dragSize.y_);
+        fixedWidthResizing_ ? SetFixedWidth(Max(dragSize.x_, resizeBorderSize.x_)) : SetWidth(dragSize.x_);
+        fixedHeightResizing_ ? SetFixedHeight(Max(dragSize.y_, resizeBorderSize.y_)) : SetHeight(dragSize.y_);
         break;
 
     case DRAG_RESIZE_LEFT:
         SetPosition(Clamp(dragBeginPosition_.x_ + delta.x_, position_.x_ - (maxSize_.x_ - size_.x_), position_.x_ + (size_.x_ - minSize_.x_)), dragBeginPosition_.y_);
         dragSize = IntVector2(dragBeginSize_.x_ - delta.x_, dragBeginSize_.y_);
-        fixedWidthResizing_ ? SetFixedWidth(dragSize.x_) : SetWidth(dragSize.x_);
+        fixedWidthResizing_ ? SetFixedWidth(Max(dragSize.x_, resizeBorderSize.x_)) : SetWidth(dragSize.x_);
         break;
 
     default: