Skip to content

Commit

Permalink
Merge pull request #136 from keremciu/v48-u
Browse files Browse the repository at this point in the history
v48 update fixes
  • Loading branch information
keremciu committed Dec 7, 2017
2 parents dafb504 + 35e747f commit 2f87ffc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 37 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
[![Latest Version](https://img.shields.io/github/release/keremciu/sketch-iconfont.svg?style=flat-square)](https://github.com/keremciu/sketch-iconfont/releases)
[![Join the chat at https://gitter.im/keremciu/sketch-iconfont](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/keremciu/sketch-iconfont?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

### Version 48 supports - 7 December 2017 (Version 4.6.0)

Guys, I'm so excited with new updates on Sketch, I will be working on this plugin again to improve your experience! hopefully, we will have a short install process and maybe can add symbol change functionality? mmmh! would be amazing. stay in touch on twitter.

I will share donations here after asking their permissions, it's a motivation thing for me and you, guys. let see what's going on.

## New version and release video is coming - 19 January 2017
- I took a video about import custom icons ([VIDEO](http://recordit.co/wy5ihqjPml))

Expand Down
41 changes: 10 additions & 31 deletions iconfont.sketchplugin/Contents/Sketch/const/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,6 @@ var Library = {
} : null
return result
},
/**
Converts a Hex String value into native RGB Percent color
Note: To convert this to true RGB you'll need to multiply each value
by 255 (eg: result.r * 255, result.g * 255)
@param {string} hexColor Hex Color (with or without #)
@return {rgba} rgbaPercent returns converted RGB value in percentage format.
*/
hexToRgbPercent: function(hexColor) {
var color = this.hexToRgb(hexColor)
var r = color.r
var g = color.g
var b = color.b
var a = 1
return {
r: r,
g: g,
b: b,
a: a
}
},
//
// Create icon layer
// Valid types for doc is Object
Expand All @@ -65,13 +45,12 @@ var Library = {
// 2. Fetch fonts.json file
var json = Library.fetch.json("config.json", plugin)
var configs = [json objectForKey:@"icon"]
var zoom = configs["Zoom"].value
var zoom = configs["Zoom"].value
var fontsize = configs["Size"].value
var color = configs["Color"].value
var configColor = configs["Color"].value
var centered = configs["Centered"].value
var replace = configs["Replace"].value
c = this.hexToRgbPercent(color);
color = MSColor.colorWithRed_green_blue_alpha(c.r,c.g,c.b,c.a);
color = MSImmutableColor.colorWithSVGString(configColor);

function createNew() {
// create a text layer contains the icon
Expand All @@ -83,8 +62,8 @@ var Library = {
} else {
[selection setFontPostscriptName:@""+fontname];
}

selection.setTextColor(color)
selection.textColor = color;
}

/*
Expand Down Expand Up @@ -173,7 +152,7 @@ var Library = {

if (parameters.centered == 1) {
// view frame
var view = doc.currentView();
var view = doc.contentDrawView();
viewFrame = [view frame];
viewHeight = viewFrame.size.height;
viewWidth = viewFrame.size.width;
Expand All @@ -193,13 +172,13 @@ var Library = {
// doc.currentPage().deselectAllLayers()

// select the text layer
[textLayer select:true byExpandingSelection:true];
[textLayer select:true byExtendingSelection:true];
// set the default font-size
textLayer.fontSize = 24;

if (parameters.zoom == 1) {
// zoom to the icon
var view = doc.currentView();
var view = doc.contentDrawView();
view.zoomToSelection();
}

Expand Down Expand Up @@ -340,7 +319,7 @@ var Library = {
var fill = style.fills().addNewStylePart()
fill.setFillType(0)
}
fill.color = MSColor.colorWithNSColor(layer.style().textStyle().attributes().NSColor)
fill.color = layer.textColor()
}

// shape horizontally center
Expand All @@ -367,7 +346,7 @@ var Library = {
layergroup.addLayers([shape,baseLayer])
parent.addLayers([layergroup])

layergroup.setIsSelected(true)
// layergroup.setIsSelected(true)

return shape;
},
Expand Down
5 changes: 3 additions & 2 deletions iconfont.sketchplugin/Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@
]
},
"identifier" : "com.keremciu.sketch.iconfont",
"version" : "4.5.3",
"version" : "4.6.0",
"description" : "Use icons like a boss.",
"name" : "Icons",
"authorEmail" : "[email protected]",
"compatibleVersion": 48,
"appcast" : "https://raw.githubusercontent.com/keremciu/sketch-iconfont/master/version.xml"
}
}
8 changes: 4 additions & 4 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<description>Use icons like a boss.</description>
<language>en</language>
<item>
<title>Version 4.5.3</title>
<title>Version 4.6.0</title>
<description>
<![CDATA[
<ul>
<li>Fixes for Sketch 45</li>
<li>Fixes for Sketch 48</li>
</ul>
]]>
</description>
<enclosure url="https://github.com/keremciu/sketch-iconfont/archive/master.zip" sparkle:version="4.5.3" />
<enclosure url="https://github.com/keremciu/sketch-iconfont/archive/master.zip" sparkle:version="4.6.0" />
</item>
</channel>
</rss>
</rss>

0 comments on commit 2f87ffc

Please sign in to comment.