Browse Source

Fix rendering issues while dragging window

Michael 7 years ago
parent
commit
84ab82bdc2
2 changed files with 3 additions and 42 deletions
  1. 3 39
      Source/Core/ElementHandle.cpp
  2. 0 3
      Source/Core/ElementHandle.h

+ 3 - 39
Source/Core/ElementHandle.cpp

@@ -25,8 +25,6 @@
  *
  */
 
-// Modified by uniquejack
-
 #include "precompiled.h"
 #include "ElementHandle.h"
 #include "../../Include/Rocket/Core/ElementDocument.h"
@@ -42,7 +40,6 @@ ElementHandle::ElementHandle(const String& tag) : Element(tag), drag_start(0, 0)
 	// Make sure we can be dragged!
 	SetProperty(DRAG, DRAG);
 
-	move_clip = NULL;
 	move_target = NULL;
 	size_target = NULL;
 	initialised = false;
@@ -58,8 +55,7 @@ void ElementHandle::OnAttributeChange(const PropertyNameList& changed_attributes
 
 	// Reset initialised state if the move or size targets have changed.
 	if (changed_attributes.find("move_target") != changed_attributes.end() ||
-		changed_attributes.find("size_target") != changed_attributes.end() ||
-		changed_attributes.find("move_clip") != changed_attributes.end())
+		changed_attributes.find("size_target") != changed_attributes.end())
 	{
 		initialised = false;
 		move_target = NULL;
@@ -84,11 +80,6 @@ void ElementHandle::ProcessEvent(Event& event)
 			if (!size_target_name.Empty())
 				size_target = GetElementById(size_target_name);
 
-			String move_clip_name = GetAttribute<String>("move_clip", "");
-            
-			if (!move_clip_name.Empty())
-				move_clip = GetElementById(move_clip_name);
-
 			initialised = true;
 		}
 
@@ -116,35 +107,8 @@ void ElementHandle::ProcessEvent(Event& event)
 			// Update the move and size objects
 			if (move_target)
 			{
-				Vector2f pos, size;
-
-				if (move_clip)
-				{
-					pos = move_clip->GetBox().GetPosition();
-					size = move_clip->GetBox().GetSize();
-				}
-
-				Vector2f move;
-				move.x = (move_original_position.x + x);
-				move.y = (move_original_position.y + y);
-
-				Vector2f object_size = move_target->GetBox().GetSize();
-
-				if (object_size.x <= size.x && object_size.y <= size.y)
-				{
-					if (move.x < pos.x)
-						move.x = pos.x;
-					else if (move.x + object_size.x > pos.x + size.x)
-						move.x = pos.x + size.x - object_size.x;
-
-					if (move.y < pos.y)
-						move.y = pos.y;
-					else if (move.y + object_size.y > pos.y + size.y)
-						move.y = pos.y + size.y - object_size.y;                
-				}
-
-				move_target->SetProperty(LEFT, Property(Math::RealToInteger(move.x), Property::PX));
-				move_target->SetProperty(TOP, Property(Math::RealToInteger(move.y), Property::PX));
+				move_target->SetProperty(LEFT, Property(Math::RealToInteger(move_original_position.x + x), Property::PX));
+				move_target->SetProperty(TOP, Property(Math::RealToInteger(move_original_position.y + y), Property::PX));
 			}
 
 			if (size_target)

+ 0 - 3
Source/Core/ElementHandle.h

@@ -25,8 +25,6 @@
  *
  */
 
-// Modified by uniquejack
-
 #ifndef ROCKETCOREELEMENTHANDLE_H
 #define ROCKETCOREELEMENTHANDLE_H
 
@@ -60,7 +58,6 @@ protected:
 
 	Element* move_target;
 	Element* size_target;
-	Element* move_clip;
 
 	bool initialised;
 };