Skip to content

Commit

Permalink
fix 同时存在背景图层和画板时保存 UI-DNA 数据的图层错位
Browse files Browse the repository at this point in the history
  • Loading branch information
nullice committed May 10, 2017
1 parent cd2d1b3 commit 6f29e4e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 51 deletions.
53 changes: 34 additions & 19 deletions DVE/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 14 additions & 16 deletions DVE/Enzymes/Enzymes_lib.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ EnzJSX.getDocumentBaseInfo_byActive = function ()
}




/**
* 根据名称获取图层 ID,不存在返回 -1
* @param layerName
Expand Down Expand Up @@ -445,10 +443,11 @@ EnzJSX.writeJSON = function (rootName, itemName, json)
if (re == undefined)
{
var upperIndex = Kinase.upperIndex()
if(Kinase.layer.isArtBoard(Kinase.REF_ItemIndex,upperIndex))
if (Kinase.layer.isArtBoard(Kinase.REF_ItemIndex, upperIndex + Kinase.BKOffset()))
{
ki.layer.selectLayer_byItemIndex(upperIndex - 1);
} else
{
ki.layer.selectLayer_byItemIndex(upperIndex-1);
}else {
ki.layer.selectLayer_byItemIndex(upperIndex);
}

Expand Down Expand Up @@ -482,16 +481,19 @@ EnzJSX.writeJSON = function (rootName, itemName, json)
var re = EnzJSX.checkLayerExist("_ui-dna.nullice.com_", "name", false, true);
if (re == undefined)
{

ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId))
ki.layer.creatNewTextLayer_ByActive("_ui-dna.nullice.com_", 100, 100, "UI-DNA 数据保存图层,请勿修改、删除")
// ki.layer.moveActiveLayerOrder(ki.layer.getItemIndexBylayerID(rootId))
ki.layer.setAppearance_byActive({
fillOpacity: 100, /*填充不透明度 0-255*/
opacity: 100, /*不透明 0-255*/
visible: false, /*可视*/
})
ki.layer.moveActiveLayerOrder(ki.layer.getItemIndexBylayerID(rootId) - 1)
ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId))

}

//图层-------------------------------------------------------

var re = EnzJSX.checkLayerExist(itemName, "name", false, true);
Expand All @@ -507,7 +509,7 @@ EnzJSX.writeJSON = function (rootName, itemName, json)

if (re == undefined || hasSameNameElse)
{
ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId) - 1)
ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId))
ki.layer.creatNewTextLayer_ByActive(itemName, 50, 100, json)
ki.layer.setAppearance_byActive({
fillOpacity: 50, /*填充不透明度 0-255*/
Expand Down Expand Up @@ -800,7 +802,7 @@ EnzJSX.setLayerInfo_shape_byId = function (shapeInfo, id, doSelect)
}
if (shapeInfo.dashSet != undefined)
{
if(shapeInfo.dashSet.split!=undefined)
if (shapeInfo.dashSet.split != undefined)
{
strokeStyle.dashSet = shapeInfo.dashSet.split(",")
}
Expand All @@ -809,7 +811,6 @@ EnzJSX.setLayerInfo_shape_byId = function (shapeInfo, id, doSelect)
}



//todo:判定是否都为 null 值,减少无效99渲染次数
$.writeln(JSON.stringify(shapeInfo))
$.writeln(JSON.stringify(strokeStyle))
Expand Down Expand Up @@ -1745,16 +1746,13 @@ EnzJSX.DNAExpress = function (mRNA_Layers_json)
*/
EnzJSX.jsxFunctionReturnJson = function (jsxFunction)
{
if(jsxFunction!=undefined)
{
return JSON.stringify( jsxFunction())
}
if (jsxFunction != undefined)
{
return JSON.stringify(jsxFunction())
}
}





EnzJSX._inArray = function (name, array, prefix)
{
for (var x in array)
Expand Down
30 changes: 14 additions & 16 deletions DVE/bin/JSX/Enzymes_lib.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ EnzJSX.getDocumentBaseInfo_byActive = function ()
}




/**
* 根据名称获取图层 ID,不存在返回 -1
* @param layerName
Expand Down Expand Up @@ -445,10 +443,11 @@ EnzJSX.writeJSON = function (rootName, itemName, json)
if (re == undefined)
{
var upperIndex = Kinase.upperIndex()
if(Kinase.layer.isArtBoard(Kinase.REF_ItemIndex,upperIndex))
if (Kinase.layer.isArtBoard(Kinase.REF_ItemIndex, upperIndex + Kinase.BKOffset()))
{
ki.layer.selectLayer_byItemIndex(upperIndex - 1);
} else
{
ki.layer.selectLayer_byItemIndex(upperIndex-1);
}else {
ki.layer.selectLayer_byItemIndex(upperIndex);
}

Expand Down Expand Up @@ -482,16 +481,19 @@ EnzJSX.writeJSON = function (rootName, itemName, json)
var re = EnzJSX.checkLayerExist("_ui-dna.nullice.com_", "name", false, true);
if (re == undefined)
{

ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId))
ki.layer.creatNewTextLayer_ByActive("_ui-dna.nullice.com_", 100, 100, "UI-DNA 数据保存图层,请勿修改、删除")
// ki.layer.moveActiveLayerOrder(ki.layer.getItemIndexBylayerID(rootId))
ki.layer.setAppearance_byActive({
fillOpacity: 100, /*填充不透明度 0-255*/
opacity: 100, /*不透明 0-255*/
visible: false, /*可视*/
})
ki.layer.moveActiveLayerOrder(ki.layer.getItemIndexBylayerID(rootId) - 1)
ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId))

}

//图层-------------------------------------------------------

var re = EnzJSX.checkLayerExist(itemName, "name", false, true);
Expand All @@ -507,7 +509,7 @@ EnzJSX.writeJSON = function (rootName, itemName, json)

if (re == undefined || hasSameNameElse)
{
ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId) - 1)
ki.layer.selectLayer_byItemIndex(ki.layer.getItemIndexBylayerID(rootId))
ki.layer.creatNewTextLayer_ByActive(itemName, 50, 100, json)
ki.layer.setAppearance_byActive({
fillOpacity: 50, /*填充不透明度 0-255*/
Expand Down Expand Up @@ -800,7 +802,7 @@ EnzJSX.setLayerInfo_shape_byId = function (shapeInfo, id, doSelect)
}
if (shapeInfo.dashSet != undefined)
{
if(shapeInfo.dashSet.split!=undefined)
if (shapeInfo.dashSet.split != undefined)
{
strokeStyle.dashSet = shapeInfo.dashSet.split(",")
}
Expand All @@ -809,7 +811,6 @@ EnzJSX.setLayerInfo_shape_byId = function (shapeInfo, id, doSelect)
}



//todo:判定是否都为 null 值,减少无效99渲染次数
$.writeln(JSON.stringify(shapeInfo))
$.writeln(JSON.stringify(strokeStyle))
Expand Down Expand Up @@ -1745,16 +1746,13 @@ EnzJSX.DNAExpress = function (mRNA_Layers_json)
*/
EnzJSX.jsxFunctionReturnJson = function (jsxFunction)
{
if(jsxFunction!=undefined)
{
return JSON.stringify( jsxFunction())
}
if (jsxFunction != undefined)
{
return JSON.stringify(jsxFunction())
}
}





EnzJSX._inArray = function (name, array, prefix)
{
for (var x in array)
Expand Down

0 comments on commit 6f29e4e

Please sign in to comment.