Commit 3fb87894 authored by zhangtingting's avatar zhangtingting

修改lineHeight设置

parent 046c83ff
{
"name": "psd-parse-web",
"version": "2.1.7",
"main": "src/index.js",
"module": "dist/index.es.js",
"license": "MIT",
"scripts": {
"test": "node test/index.js",
"dev": "rollup -c -w",
"build": "rollup -c"
},
"dependencies": {
"color": "^3.1.2",
"fs-extra": "^9.0.1",
"object-hash": "^2.0.1",
"psd": "3.2.0",
"uuid": "^3.3.3"
}
}
"name": "psd-parse-web",
"version": "2.1.8",
"main": "src/index.js",
"module": "dist/index.es.js",
"license": "MIT",
"scripts": {
"test": "node test/index.js",
"dev": "rollup -c -w",
"build": "rollup -c"
},
"dependencies": {
"color": "^3.1.2",
"fs-extra": "^9.0.1",
"object-hash": "^2.0.1",
"psd": "3.2.0",
"uuid": "^3.3.3"
}
}
\ No newline at end of file
......@@ -125,9 +125,10 @@ async function compilePsdToJson(psdFile, options) {
properties.style.fontSize = parseInt(fsize);//字体取整
//字体取整情况下有可能导致宽度不够,默认扩大10像素
viewNode.properties.style.width += 10;
viewNode.properties.style.lineHeight = `${height}`;
if((height / fsize) < 2){ //超过两行不设置行高
viewNode.properties.style.lineHeight = `${height}`;
}
let [r, g, b, a] = colors[0];
properties.style.color = `rgba(${r}, ${g}, ${b}, ${a / 255})`;
......
var {execute}= require( '../src/index');
var {execute, compilePsdToJson}= require( '../src/index');
let test = async()=>{
let result = await execute('/Users/davezh/Downloads/1.psd',{mode:'none',singleView:true})
let result = await execute('/Users/tiffany/Downloads/1.psd',{mode:'none',projectPath: '/Users/tiffany/Downloads/test/', singleView:true})
console.log("---------");
console.log(result);
// await compilePsdToJson('/Users/tiffany/Downloads/1.psd', { mode: 'none', singleView: true, assetsPath: '/Users/tiffany/Downloads/test/' });
}
test();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment