Browse Source

Merge pull request #908 from ablake/next

Quick fix for ImageControl default regions.
Sean Paul Taylor 12 years ago
parent
commit
996de43856
2 changed files with 14 additions and 6 deletions
  1. 13 5
      gameplay/src/ImageControl.cpp
  2. 1 1
      gameplay/src/ImageControl.h

+ 13 - 5
gameplay/src/ImageControl.cpp

@@ -53,11 +53,19 @@ void ImageControl::initialize(Theme::Style* style, Properties* properties)
         setImage(path);
     }
 
-    Vector4 region;
-    properties->getVector4("srcRegion", &region);
-    setRegionSrc(region.x, region.y, region.z, region.w);
-    properties->getVector4("dstRegion", &region);
-    setRegionDst(region.x, region.y, region.z, region.w);
+    if (properties->exists("srcRegion"))
+    {
+        Vector4 region;
+        properties->getVector4("srcRegion", &region);
+        setRegionSrc(region.x, region.y, region.z, region.w);
+    }
+
+    if (properties->exists("dstRegion"))
+    {
+        Vector4 region;
+        properties->getVector4("dstRegion", &region);
+        setRegionDst(region.x, region.y, region.z, region.w);
+    }
 }
 
 void ImageControl::setImage(const char* path)

+ 1 - 1
gameplay/src/ImageControl.h

@@ -16,7 +16,7 @@ namespace gameplay
  * The following properties are available for image controls:
 
  @verbatim
-     imageControl <control ID>
+     image <control ID>
      {
          style          = <styleID>
          alignment      = <Control::Alignment constant> // Note: 'position' will be ignored.