Skip to content

Commit

Permalink
The map that is generated based on the last one created now respects …
Browse files Browse the repository at this point in the history
…the proportions of the new figure instead of keeping the previous ones
  • Loading branch information
eddiesigner committed Jan 13, 2020
1 parent 58c491b commit e8f5a17
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Map Generator.sketchplugin/Contents/Sketch/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ GenericMap.prototype.generateLastMap = function (context) {
return;
} else {
var layer = context.selection[0];
var layerSizes = layer.frame();
var lastService = getPreferences('lastservice', '');
var lastUrl = getPreferences('lasturl', '');
var lastAddress = getPreferences('lastaddress', '');
var lastZoom = getPreferences('lastzoom', '');
var lastWidth = getPreferences('lastwidth', '');
var lastHeight = getPreferences('lastheight', '');

if (lastWidth && lastHeight) {
lastUrl = lastUrl.replace(lastWidth + 'x' + lastHeight, parseInt([layerSizes width]) + 'x' + parseInt([layerSizes height]));
}

if (lastService && lastUrl && lastAddress && lastZoom) {
fillLayerWithImage(lastUrl, layer, context, lastService);
Expand Down
2 changes: 2 additions & 0 deletions Map Generator.sketchplugin/Contents/Sketch/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ GoogleMap.prototype.generateMap = function (values, context, window) {
setPreferences('lasturl', imageUrl);
setPreferences('lastaddress', values.address);
setPreferences('lastzoom', values.zoom);
setPreferences('lastwidth', parseInt([layerSizes width]));
setPreferences('lastheight', parseInt([layerSizes height]));

fillLayerWithImage(imageUrl, layer, context, this.service);
setLayerName(layer, values.address, values.zoom);
Expand Down
2 changes: 1 addition & 1 deletion Map Generator.sketchplugin/Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"icon": "icon.png",
"identifier" : "io.eduardogomez.sketch.map-generator",
"appcast": "https://raw.githubusercontent.com/eddiesigner/sketch-map-generator/master/appcast.xml",
"version" : "3.5.3",
"version" : "3.5.4",
"description" : "Sketch plugin to fill a layer with a map generated from a given location using Google Maps and Mapbox",
"authorEmail" : "[email protected]",
"name" : "Map Generator"
Expand Down
2 changes: 2 additions & 0 deletions Map Generator.sketchplugin/Contents/Sketch/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ MapboxMap.prototype.generateMap = function (values, context, window) {
setPreferences('lasturl', imageUrl);
setPreferences('lastaddress', values.address);
setPreferences('lastzoom', values.zoom);
setPreferences('lastwidth', parseInt([layerSizes width]));
setPreferences('lastheight', parseInt([layerSizes height]));

fillLayerWithImage(imageUrl, layer, context, this.service);
setLayerName(layer, values.address, values.zoom);
Expand Down
11 changes: 11 additions & 0 deletions appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,16 @@
</description>
<enclosure url="https://github.com/eddiesigner/sketch-map-generator/archive/v3.5.3.zip" sparkle:version="3.5.3" />
</item>
<item>
<title>Version 3.5.4</title>
<description>
<![CDATA[
<ul>
<li>🛠 The map that is generated based on the last one created now respects the proportions of the new figure instead of keeping the previous ones.</li>
</ul>
]]>
</description>
<enclosure url="https://github.com/eddiesigner/sketch-map-generator/archive/v3.5.4.zip" sparkle:version="3.5.4" />
</item>
</channel>
</rss>

0 comments on commit e8f5a17

Please sign in to comment.