Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

文字图层增加字号显示 #49

Merged
merged 4 commits into from
Oct 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions marketch.sketchplugin/Contents/Sketch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,9 @@
)
}

//文字图层显示内容及字号
if(layerData.html){
//内容块
html.push(
'<dl class="pa-block">',
'<dt><span>', this.I18N['LAYERTEXT'] ,'</span><em>', this.I18N['COPYSUCCESS'] ,'</em></dt>',
Expand All @@ -831,6 +833,16 @@
'</dd>',
'</dl>'
)

//字号块:根据用户选择转换单位
html.push(
'<dl class="pa-block">',
'<dt><span>', this.I18N['FONTSIZE'] ,'</span><em>', this.I18N['COPYSUCCESS'] ,'</em></dt>',
'<dd>',
'<textarea name="fontSize">', this.getScale(layerData.style["font-size"]) ,'</textarea>',
'</dd>',
'</dl>'
)
}

if(layerData.style){
Expand Down Expand Up @@ -1024,10 +1036,11 @@
},

getScale: function(pixel) {
var pixelNum = parseInt(pixel, 10);
var scales = {
px: pixel + 'px',
pt: pixel * 0.75 / this.unit.factor + 'pt',
dp: pixel / this.unit.factor + 'dp'
px: pixelNum + 'px',
pt: pixelNum * 0.75 / this.unit.factor + 'pt',
dp: pixelNum / this.unit.factor + 'dp'
}

return scales[this.unit.unit];
Expand Down
2 changes: 2 additions & 0 deletions marketch.sketchplugin/Contents/Sketch/util.cocoascript
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ var util = {
'FILLCOLOR': '填充色',
'RADIUS': '圆角',
'LAYERTEXT': '图层内容',
'FONTSIZE': '字号',
'CODE': '代码',
'EXPORT': '导出',
'FORMAT': '格式',
Expand Down Expand Up @@ -212,6 +213,7 @@ var util = {
'FILLCOLOR': 'Fill',
'RADIUS': 'Radius',
'LAYERTEXT': 'Content',
'FONTSIZE': 'Font size',
'CODE': 'Code',
'EXPORT': 'Export',
'FORMAT': 'Format',
Expand Down