package org.meganekkovr.xml;

import android.content.Context;

import org.meganekkovr.Entity;

/**
 * Define {@code scale} attribute.
 */
class ScaleHandler implements XmlAttributeParser.XmlAttributeHandler {

    @Override
    public String attributeName() {
        return "scale";
    }

    @Override
    public void parse(Entity entity, String rawValue, Context context) {

        String[] strs = rawValue.split("\\s+", 3);
        if (strs.length == 3) {
            float x = Float.parseFloat(strs[0]);
            float y = Float.parseFloat(strs[1]);
            float z = Float.parseFloat(strs[2]);
            entity.setScale(x, y, z);
        }
    }
}

@@ -454,12 +454,583 @@
  == 
-3) %7B
+1) %7B%0A%0A            // ex. scale=%221.2%22%0A            // Apply scaling to all axises.%0A%0A            float scale = Float.parseFloat(strs%5B0%5D);%0A            entity.setScale(scale, scale, scale);%0A%0A        %7D else if (strs.length == 2) %7B%0A%0A            // ex. scale=%220.5 2.0%22%0A            // Apply scaling to X and Y axises.%0A%0A            float x = Float.parseFloat(strs%5B0%5D);%0A            float y = Float.parseFloat(strs%5B1%5D);%0A            entity.setScale(x, y, 1.0f);%0A%0A        %7D else if (strs.length == 3) %7B%0A%0A            // ex. scale=%221.1 1.25 2.0%22%0A            // Apply scaling to each axises.%0A
 %0A   
@@ -1169,24 +1169,24 @@
 t(strs%5B2%5D);%0A
-
             
@@ -1211,16 +1211,17 @@
  y, z);%0A
+%0A
         

scale attribute can take 1, 2 or 3 values ex. scale="2", scale="0.5 1.2", scale="1.1 1.2 1.3"