Permalink
Browse files

Build 0.4.13 - New method to update dimensions after changing padding

  • Loading branch information...
1 parent d9f8976 commit 879a9e5914ef784f5bd9e3384f44fdf512a42d4a @draeton committed Jan 25, 2012
View
@@ -1,19 +1,19 @@
## Stitches
[Stitches](http://draeton.github.com/stitches/) is an HTML5 sprite sheet generator.
-The current version is `0.4.12`. Documentation is available
+The current version is `0.4.13`. Documentation is available
[here](http://draeton.github.com/stitches/stitches/docs/stitches.html).
## Implementation
Stitches requires a stylesheet, a script, and an HTML element to get the job done:
- <link rel="stylesheet" href="css/stitches-0.4.12-min.css">
+ <link rel="stylesheet" href="css/stitches-0.4.13-min.css">
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/modernizr-2.0.6.min.js"></script>
- <script src="js/stitches-0.4.12-min.js"></script>
+ <script src="js/stitches-0.4.13-min.js"></script>
Once that's in place, the sprite sheet generator is created by the `init` method:
View
@@ -1,4 +1,4 @@
-#Wed, 25 Jan 2012 11:43:05 -0500
+#Wed, 25 Jan 2012 11:49:40 -0500
build.major=0
build.minor=4
-build.number=12
+build.number=13
File renamed without changes.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -774,6 +774,7 @@
$options.delegate("input[name=padding]", "change", function () {
var padding = Stitches.Page.inputs.$padding.val();
Stitches.settings.padding = +padding;
+ Stitches.Page.updateIconDimensions();
});
$options.delegate("input[name=dataURI]", "change", function () {
@@ -819,6 +820,18 @@
})
.fadeOut("fast")
.remove();
+ },
+
+ // ### updateIconDimensions
+ //
+ // Update icon dimensions after changing padding setting
+ updateIconDimensions: function () {
+ var padding = Stitches.setting.padding;
+
+ $.each(Stitches.iconQueue, function (i, icon) {
+ icon.width = icon.image.width + padding;
+ icon.height = icon.image.height + padding;
+ });
}
};
})();
View
Binary file not shown.
View
@@ -224,6 +224,7 @@
<span class="nx">$options</span><span class="p">.</span><span class="nx">delegate</span><span class="p">(</span><span class="s2">&quot;input[name=padding]&quot;</span><span class="p">,</span> <span class="s2">&quot;change&quot;</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">padding</span> <span class="o">=</span> <span class="nx">Stitches</span><span class="p">.</span><span class="nx">Page</span><span class="p">.</span><span class="nx">inputs</span><span class="p">.</span><span class="nx">$padding</span><span class="p">.</span><span class="nx">val</span><span class="p">();</span>
<span class="nx">Stitches</span><span class="p">.</span><span class="nx">settings</span><span class="p">.</span><span class="nx">padding</span> <span class="o">=</span> <span class="o">+</span><span class="nx">padding</span><span class="p">;</span>
+ <span class="nx">Stitches</span><span class="p">.</span><span class="nx">Page</span><span class="p">.</span><span class="nx">updateIconDimensions</span><span class="p">();</span>
<span class="p">});</span>
<span class="nx">$options</span><span class="p">.</span><span class="nx">delegate</span><span class="p">(</span><span class="s2">&quot;input[name=dataURI]&quot;</span><span class="p">,</span> <span class="s2">&quot;change&quot;</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
@@ -269,6 +270,18 @@
<span class="p">})</span>
<span class="p">.</span><span class="nx">fadeOut</span><span class="p">(</span><span class="s2">&quot;fast&quot;</span><span class="p">)</span>
<span class="p">.</span><span class="nx">remove</span><span class="p">();</span>
+ <span class="p">},</span>
+
+</pre></div> </td> </tr> <tr id="section-21"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-21">&#182;</a> </div> <h3>updateIconDimensions</h3>
+
+<p>Update icon dimensions after changing padding setting</p> </td> <td class="code"> <div class="highlight"><pre>
+ <span class="nx">updateIconDimensions</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">padding</span> <span class="o">=</span> <span class="nx">Stitches</span><span class="p">.</span><span class="nx">setting</span><span class="p">.</span><span class="nx">padding</span><span class="p">;</span>
+
+ <span class="nx">$</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">Stitches</span><span class="p">.</span><span class="nx">iconQueue</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="nx">icon</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">icon</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">icon</span><span class="p">.</span><span class="nx">image</span><span class="p">.</span><span class="nx">width</span> <span class="o">+</span> <span class="nx">padding</span><span class="p">;</span>
+ <span class="nx">icon</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">icon</span><span class="p">.</span><span class="nx">image</span><span class="p">.</span><span class="nx">height</span> <span class="o">+</span> <span class="nx">padding</span><span class="p">;</span>
+ <span class="p">});</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">})();</span>
View
@@ -225,6 +225,7 @@
$options.delegate("input[name=padding]", "change", function () {
var padding = Stitches.Page.inputs.$padding.val();
Stitches.settings.padding = +padding;
+ Stitches.Page.updateIconDimensions();
});
$options.delegate("input[name=dataURI]", "change", function () {
@@ -270,6 +271,18 @@
})
.fadeOut("fast")
.remove();
+ },
+
+ // ### updateIconDimensions
+ //
+ // Update icon dimensions after changing padding setting
+ updateIconDimensions: function () {
+ var padding = Stitches.setting.padding;
+
+ $.each(Stitches.iconQueue, function (i, icon) {
+ icon.width = icon.image.width + padding;
+ icon.height = icon.image.height + padding;
+ });
}
};
})();

0 comments on commit 879a9e5

Please sign in to comment.