Skip to content

Commit

Permalink
Fixed a bug which calculated the row height based on the last item in…
Browse files Browse the repository at this point in the history
…stead of the tallest
  • Loading branch information
Myrronth committed Mar 12, 2018
1 parent f256b58 commit f9b0ce8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Tobias Kreß",
"email": "kress@pixelflut.net",
"homepage": "https://github.com/Myrronth/symbol-and-artboard-organizer",
"version": "1.0.1",
"version": "1.0.2",
"identifier": "net.pixelflut.sketch.symbol-and-artboard-organizerl",
"appcast": "https://github.com/Myrronth/symbol-and-artboard-organizer/appcast.xml",
"compatibleVersion": "47",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var onRun = function(context) {
var verticalGap = 100;
var symbolArtboardGap = 500;

var x, y, lastArtboardProxy, lastSymbolProxy;
var x, y, maxHeight, lastArtboardProxy, lastSymbolProxy;

artboards.forEach(function(artboard) {
if(artboard.class() == 'MSArtboardGroup') {
Expand Down Expand Up @@ -54,10 +54,10 @@ var onRun = function(context) {

x = 0;
y = 0;
maxHeight = 0;
lastSymbolProxy = null;

var maxWidth = 0;
var maxHeight = 0;

symbolProxies.forEach(function(symbolProxy) {
var symbol = symbolProxy.symbol;
Expand Down Expand Up @@ -118,6 +118,7 @@ var onRun = function(context) {

x = 0;
y = 0;
maxHeight = 0;
lastArtboardProxy = null;

artboardProxies.forEach(function(artboardProxy) {
Expand All @@ -127,7 +128,9 @@ var onRun = function(context) {
if(lastArtboardProxy) {
if(lastArtboardProxy.scope != scope && lastArtboardProxy.artboard.name() != scope) {
x = 0;
y += lastArtboardProxy.artboard.frame().height() + verticalGap;
y += maxHeight + verticalGap;

maxHeight = 0;
} else {
x += lastArtboardProxy.artboard.frame().width() + horizontalGap;
y = lastArtboardProxy.artboard.frame().y();
Expand All @@ -139,6 +142,7 @@ var onRun = function(context) {

artboard.frame().setOrigin({x, y});

maxHeight = Math.max(maxHeight, artboardProxy.artboard.frame().height());
lastArtboardProxy = artboardProxy;
});

Expand Down
11 changes: 11 additions & 0 deletions appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,16 @@
</description>
<enclosure url="https://github.com/Myrronth/symbol-and-artboard-organizer/archive/1.0.1.zip" sparkle:version="1.0.1" />
</item>
<item>
<title>Version 1.0.2</title>
<description>
<![CDATA[
<ul>
<li>Fixed a bug which calculated the row height based on the last item instead of the tallest</li>
</ul>
]]>
</description>
<enclosure url="https://github.com/Myrronth/symbol-and-artboard-organizer/archive/1.0.2.zip" sparkle:version="1.0.2" />
</item>
</channel>
</rss>

0 comments on commit f9b0ce8

Please sign in to comment.