Browse Source

Fixed entity property editor, fixed mouse position not setting on mousedown

Ivan Safrin 13 năm trước cách đây
mục cha
commit
78300e7cae

+ 0 - 1
Core/Contents/Include/PolyCoreInput.h

@@ -151,7 +151,6 @@ namespace Polycode {
 		
 		void clearInput();
 		
-	protected:
 		
 		std::vector<JoystickInfo> joysticks;
 		bool keyboardState[512];

+ 2 - 0
Core/Contents/Source/PolyCocoaCore.mm

@@ -412,6 +412,8 @@ void CocoaCore::checkEvents() {
 						input->setMousePosition(event.mouseX, event.mouseY, getTicks());						
 						break;
 					case InputEvent::EVENT_MOUSEDOWN:
+						input->mousePosition.x = event.mouseX;
+						input->mousePosition.y = event.mouseY;
 						input->setMouseButtonState(event.mouseButton, true, getTicks());						
 						break;
 					case InputEvent::EVENT_MOUSEWHEEL_UP:

+ 2 - 0
IDE/Contents/Include/PolycodeProps.h

@@ -276,6 +276,8 @@ class EntityPropSheet : public PropSheet {
 		Entity *entity;
 		Entity *lastEntity;
 		
+		int lastNumProps;
+		
 		int removeIndex;
 		
 };

+ 11 - 1
IDE/Contents/Source/PolycodeProps.cpp

@@ -961,6 +961,8 @@ EntityPropSheet::EntityPropSheet() : PropSheet("CUSTOM PROPERTIES", "entityProps
 	entity = NULL;
 	lastEntity = NULL;
 	
+	lastNumProps = 0;
+	
 	removeIndex = -1;
 }
 
@@ -1010,8 +1012,16 @@ void EntityPropSheet::refreshProps() {
 		propHeight += 35;
 	}
 	
+	
 	addButton->setPosition(15, propHeight-40);	
-	dispatchEvent(new Event(), Event::CHANGE_EVENT);
+	
+	
+	if(lastNumProps != entity->entityProps.size()) {
+		dispatchEvent(new Event(), Event::CHANGE_EVENT);
+	}
+	
+	lastNumProps = entity->entityProps.size();
+		
 	Resize(width, height);	
 }
 

+ 2 - 1
IDE/Contents/Source/PolycodeScreenEditor.cpp

@@ -1663,8 +1663,9 @@ void PolycodeScreenEditorMain::handleEvent(Event *event) {
 		
 	}
 
-	if(event->getDispatcher() == entityPropSheet) {
+	if(event->getDispatcher() == entityPropSheet && event->getEventType() == "") {
 			entityProps->updateSize();
+			entityProps->scrollContainer->setScrollValue(0.0, 1.0);
 	}
 	
 	if((event->getDispatcher() == transform2dSheet || event->getDispatcher() == labelSheet || event->getDispatcher() == imageSheet) && event->getEventType() == "") {