diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Modules/module.modulemap b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Modules/module.modulemap new file mode 100644 index 0000000..750cbcb --- /dev/null +++ b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module SMFramework { + umbrella header "SMFramework.h" + + export * + module * { export * } +} diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Resources/Info.plist b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Resources/Info.plist index 51a130b..03d9e3e 100644 --- a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Resources/Info.plist +++ b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 17D102 + 18A391 CFBundleDevelopmentRegion en CFBundleExecutable @@ -27,17 +27,17 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 8A218a + 10A255 DTPlatformVersion GM DTSDKBuild - 16A300 + 18A384 DTSDKName - macosx10.12 + macosx10.14 DTXcode - 0800 + 1000 DTXcodeBuild - 8A218a + 10A255 NSHumanReadableCopyright Copyright © 2017 UTOMBOX. All rights reserved. diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/SMFramework b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/SMFramework index 3805713..7e7d37e 100755 Binary files a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/SMFramework and b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/SMFramework differ diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/Resources/Info.plist b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/Resources/Info.plist index 51a130b..03d9e3e 100644 --- a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/Resources/Info.plist +++ b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 17D102 + 18A391 CFBundleDevelopmentRegion en CFBundleExecutable @@ -27,17 +27,17 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 8A218a + 10A255 DTPlatformVersion GM DTSDKBuild - 16A300 + 18A384 DTSDKName - macosx10.12 + macosx10.14 DTXcode - 0800 + 1000 DTXcodeBuild - 8A218a + 10A255 NSHumanReadableCopyright Copyright © 2017 UTOMBOX. All rights reserved. diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/SMFramework b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/SMFramework index 3805713..7e7d37e 100755 Binary files a/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/SMFramework and b/Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/SMFramework differ diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/library/common.js b/Sketch Measure.sketchplugin/Contents/Sketch/library/common.js index db5b0ec..6c081fe 100755 --- a/Sketch Measure.sketchplugin/Contents/Sketch/library/common.js +++ b/Sketch Measure.sketchplugin/Contents/Sketch/library/common.js @@ -447,38 +447,19 @@ SM.extend({ return style.contextSettings().opacity() }, getStyleName: function(layer){ - if(layer.sharedStyleID()){ - var styles = (this.is(layer, MSTextLayer))? this.document.documentData().layerTextStyles(): this.document.documentData().layerStyles(), - layerStyle = layer.style(), - sharedObjectID = layer.sharedStyleID(), - style; - - styles = styles.objectsSortedByName(); - - if(styles.count() > 0){ - style = this.find({key: "(objectID != NULL) && (objectID == %@)", match: sharedObjectID}, styles); - } - - if(!style){ - var styles = (this.is(layer, MSTextLayer))? this.document.documentData().foreignTextStyles(): this.document.documentData().foreignLayerStyles(), - layerStyle = layer.style(), - sharedObjectID = layer.sharedStyleID(), - style; - - styles.forEach(libraryStyle => { - if(String(libraryStyle.localSharedStyle().objectID()) == String(sharedObjectID)){ - style = libraryStyle.localSharedStyle().name(); - } - }); - - if(!style) return ""; - return this.toJSString(style); - } - return this.toJSString(style.name()); + var styles = (this.is(layer, MSTextLayer))? this.document.documentData().layerTextStyles(): this.document.documentData().layerStyles(), + layerStyle = layer.style(), + sharedObjectID = layerStyle.objectID(), + style; - } else { - return ""; + styles = styles.objectsSortedByName(); + + if(styles.count() > 0){ + style = this.find({key: "(objectID != NULL) && (objectID == %@)", match: sharedObjectID}, styles); } + + if(!style) return ""; + return this.toJSString(style.name()); }, updateContext: function(){ this.context.document = NSDocumentController.sharedDocumentController().currentDocument(); @@ -494,10 +475,10 @@ SM.extend({ return Math.round( number / 2 ); }, convertUnit: function(length, isText, percentageType){ - if(Array.isArray(length)){ + if(length.length){ var units = this.configs.unit.split("/"), unit = units[0]; - + if( units.length > 1 && isText){ unit = units[1]; } @@ -508,8 +489,8 @@ SM.extend({ length.forEach(function(element) { tempLegth.push(Math.round( element / scale * 10 ) / 10); }); - - return tempLegth.join(unit + ' ') + unit; + + return tempLegth.join(unit + ' ') + unit; } else { @@ -522,18 +503,18 @@ SM.extend({ return Math.round((length / artboardRect.height) * 1000) / 10 + "%"; } } - + var length = Math.round( length / this.configs.scale * 10 ) / 10, units = this.configs.unit.split("/"), unit = units[0]; - + if( units.length > 1 && isText){ unit = units[1]; } - + return length + unit; } - + }, toHex:function(c) { var hex = Math.round(c).toString(16).toUpperCase(); @@ -902,8 +883,8 @@ SM.extend({ // rect function var x = targetRect.x + this.mathHalf(targetRect.width) - this.mathHalf(textRect.width), y = targetRect.y + this.mathHalf(targetRect.height) - this.mathHalf(textRect.height), - arrowX = x - 4 + this.mathHalf(textRect.width + 8) - 4, - arrowY = y - 4 + this.mathHalf(textRect.height + 8) - 4; + arrowX = x - 3 + this.mathHalf(textRect.width + 6) - 3, + arrowY = y - 3 + this.mathHalf(textRect.height + 6) - 3; if(!this.is(target, MSPage) && !this.is(target, MSArtboardGroup)){ switch(placement){ @@ -951,11 +932,11 @@ SM.extend({ boxRect.setWidth(textRect.width + 8); boxRect.setHeight(textRect.height + 8); - arrowRect.setWidth(8); - arrowRect.setHeight(8); + arrowRect.setWidth(6); + arrowRect.setHeight(6); arrowRect.setX(arrowX); arrowRect.setY(arrowY); - arrow.setRotation(45); + arrow.setRotation(45); return { element: box, @@ -1558,8 +1539,10 @@ SM.extend({ } }); + SM.extend({ overlay: function(target){ + //Crashing on exception: -[MSImmutableSharedStyle hasMarkers]: unrecognized selector sent to instance 0x608002a4f510 var targetRect = this.getRect(target), name = "OVERLAY#" + target.objectID(), container = this.find({key: "(name != NULL) && (name == %@)", match: name}), @@ -2948,8 +2931,9 @@ SM.extend({ exporting = true; var artboard = self.selectionArtboards[artboardIndex], page = artboard.parentGroup(), - layer = artboard.children()[layerIndex]; - log( page.name() + ' - ' + artboard.name() + ' - ' + layer.name()); + layer = artboard.children()[layerIndex], + message = page.name() + ' - ' + artboard.name() + ' - ' + layer.name(); + // log( page.name() + ' - ' + artboard.name() + ' - ' + layer.name()); try { self.getLayer( artboard, // Sketch artboard element @@ -2961,7 +2945,8 @@ SM.extend({ exporting = false; } catch (e) { self.wantsStop = true; - processing.evaluateWebScript("$('#processing-text').html('Error: " + self.toHTMLEncode(e.message) + "');"); + log(e) + processing.evaluateWebScript("$('#processing-text').html('" + self.toHTMLEncode(message) + "');"); } if( layerIndex >= artboard.children().length ){ @@ -3116,9 +3101,7 @@ SM.extend({ layerStates = this.getStates(layer); if(layer && this.is(layer, MSLayerGroup) && /NOTE\#/.exec(layer.name())){ - for (var i = 0; i < layer.children().count(); i++) { - if(this.is(layer.children()[i], MSTextLayer)) var textLayer = layer.children()[i]; - } + var textLayer = layer.children()[2]; data.notes.push({ rect: this.rectToJSON(textLayer.absoluteRect(), artboardRect), @@ -3133,8 +3116,7 @@ SM.extend({ ( layerStates.isLocked && !this.is(layer, MSSliceLayer) ) || layerStates.isEmpty || layerStates.hasSlice || - layerStates.isMeasure || - layer.isMasked() + layerStates.isMeasure ){ return this; } @@ -3198,15 +3180,14 @@ SM.extend({ var layerCSSAttributes = layer.CSSAttributes(), css = []; - + for(var i = 0; i < layerCSSAttributes.count(); i++) { var c = layerCSSAttributes[i] if(! /\/\*/.exec(c) ) css.push(this.toJSString(c)); } - - if(css.length > 0 || layer.CSSAttributes().length > 0) { + if(css.length > 0) { layerData.css = css; - if(this.is(layer, MSRectangleShape) && !!layer.cornerRadiusString() && layer.cornerRadiusString() != 0 && !/border-radius/.exec(layer.CSSAttributes())){ + if(this.is(layer, MSRectangleShape) && !!layer.fixedRadius()){ layerData.css.push('border-radius: ' + layer.cornerRadiusString().replace(/;/g,'px ') + 'px;'); } } diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-en.json b/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-en.json index 35ef517..3991ed1 100755 --- a/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-en.json +++ b/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-en.json @@ -177,7 +177,7 @@ "identifier": "com.utom.measure", "appcast": "https://raw.githubusercontent.com/utom/sketch-measure/master/appcast.xml", "homepage": "http://utom.design/measure/", - "version": "2.7.6", + "version": "2.7.7", "description" : "Make it a fun to create spec for developers and teammates", "authorEmail" : "utombox@gmail.com", "name" : "Sketch Measure" diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hans.json b/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hans.json index a063287..1ed2ae8 100755 --- a/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hans.json +++ b/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hans.json @@ -180,7 +180,7 @@ "identifier": "com.utom.measure", "appcast": "https://raw.githubusercontent.com/utom/sketch-measure/master/appcast.xml", "homepage": "http://utom.design/measure/", - "version": "2.7.6", + "version": "2.7.7", "description" : "Make it a fun to create spec for developers and teammates", "authorEmail" : "utombox@gmail.com", "name" : "Sketch Measure" diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hant.json b/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hant.json index 9d3b94b..8b9620e 100755 --- a/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hant.json +++ b/Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hant.json @@ -180,7 +180,7 @@ "identifier": "com.utom.measure", "appcast": "https://raw.githubusercontent.com/utom/sketch-measure/master/appcast.xml", "homepage": "http://utom.design/measure/", - "version": "2.7.6", + "version": "2.7.7", "description" : "Make it a fun to create spec for developers and teammates", "authorEmail" : "utombox@gmail.com", "name" : "Sketch Measure" diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/library/template.html b/Sketch Measure.sketchplugin/Contents/Sketch/library/template.html index a2c746e..72e68a5 100755 --- a/Sketch Measure.sketchplugin/Contents/Sketch/library/template.html +++ b/Sketch Measure.sketchplugin/Contents/Sketch/library/template.html @@ -232,35 +232,13 @@ return (Math.round( size / size2 * 1000 ) / 10) + "%"; }, unitSize: function(length, isText){ - if(Array.isArray(length)){ - - var units = this.configs.unit.split("/"), - unit = units[0]; - - if( units.length > 1 && isText){ - unit = units[1]; - } - - var scale = this.configs.scale; - var tempLegth = []; - - length.forEach(function(element) { - tempLegth.push(Math.round( element / scale * 10 ) / 10); - }); - - return tempLegth.join(unit + ' ') + unit; - - } else { - - var length = Math.round( length / this.configs.scale * 10 ) / 10, - units = this.configs.unit.split("/"), - unit = units[0]; - if( units.length > 1 && isText){ - unit = units[1]; - } - return length + unit; + var length = Math.round( length / this.configs.scale * 100 ) / 100, + units = this.configs.unit.split("/"), + unit = units[0]; + if( units.length > 1 && isText){ + unit = units[1]; } - + return length + unit; }, scaleSize: function (length){ return Math.round( length / this.configs.scale * 10 ) / 10; @@ -908,6 +886,7 @@ radius = (layerData.radius)? [ '
', '', + '', '
' ].join(''): '', styleName = (layerData.styleName)? [ diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/links.sketchscript b/Sketch Measure.sketchplugin/Contents/Sketch/links.sketchscript index fee7ce9..3c4260f 100755 --- a/Sketch Measure.sketchplugin/Contents/Sketch/links.sketchscript +++ b/Sketch Measure.sketchplugin/Contents/Sketch/links.sketchscript @@ -12,7 +12,7 @@ function linkHelp(){ } function linkZhCNHelp(){ - openURL('http://sketch.im/plugins/1'); + openURL('http://sketch.cm/plugins/1'); } function linkFeedback(){ diff --git a/Sketch Measure.sketchplugin/Contents/Sketch/manifest.json b/Sketch Measure.sketchplugin/Contents/Sketch/manifest.json index 35ef517..3991ed1 100755 --- a/Sketch Measure.sketchplugin/Contents/Sketch/manifest.json +++ b/Sketch Measure.sketchplugin/Contents/Sketch/manifest.json @@ -177,7 +177,7 @@ "identifier": "com.utom.measure", "appcast": "https://raw.githubusercontent.com/utom/sketch-measure/master/appcast.xml", "homepage": "http://utom.design/measure/", - "version": "2.7.6", + "version": "2.7.7", "description" : "Make it a fun to create spec for developers and teammates", "authorEmail" : "utombox@gmail.com", "name" : "Sketch Measure" diff --git a/appcast.xml b/appcast.xml index ddbca04..9b45523 100644 --- a/appcast.xml +++ b/appcast.xml @@ -6,7 +6,7 @@ Make it a fun to create spec for developers and teammates en - Version 2.7.5 + Version 2.7.7 @@ -14,76 +14,7 @@ ]]> - + - - - Version 2.7.5 - - -
  • Support Sketch v50
  • - - ]]> -
    - -
    - - Version 2.7.4 - - -
  • Support Sketch v49
  • - - ]]> -
    - -
    - - Version 2.7 - - -
  • Support Sketch v48
  • - - ]]> -
    - -
    - - Version 2.6.12 - - -
  • Fixed “Update issue”
  • - - ]]> -
    - -
    - - Version 2.6.6 - - -
  • Fixed “Cannot export JPG”
  • - - ]]> -
    - -
    - - Version 2.5 - - -
  • Export layer influence rect
  • -
  • Emoji support
  • -
  • CSS Rem 16px
  • - - ]]> -
    - -