Skip to content
Permalink
Browse files

Fix masking issues, add new tests

  • Loading branch information...
Koen Bok
Koen Bok committed Dec 18, 2015
1 parent 3f2c0e2 commit d8cabe84c640068799fc77cee5c6cdf1542dfdea
Showing with 1,148 additions and 9 deletions.
  1. +1 −9 framer/Importer.coffee
  2. BIN test/static/ExternalDocument/innermasks.sketch
  3. +33 −0 test/static/ExternalDocument/innermasks@1x.out.json
  4. BIN .../static/ExternalDocument/innermasks@1x/images/Layer-BoxA-9B5EFFBF-8BA1-4307-836F-971E2E31EF91.png
  5. BIN .../static/ExternalDocument/innermasks@1x/images/Layer-BoxB-DEF72836-25A5-4BD3-8B8F-4C41BC3D050E.png
  6. BIN .../static/ExternalDocument/innermasks@1x/images/Layer-BoxC-08A4C240-563F-43FD-B05F-FE6CAC1DDEEB.png
  7. +90 −0 test/static/ExternalDocument/innermasks@1x/layers.json
  8. +92 −0 test/static/ExternalDocument/innermasks@1x/layers.json.js
  9. BIN test/static/ExternalDocument/masks.sketch
  10. +86 −0 test/static/ExternalDocument/masks@1x.out.json
  11. BIN test/static/ExternalDocument/masks@1x/images/Layer-labels-5D3F55C0-2333-4FB4-8368-FAC412C6BC72.png
  12. BIN test/static/ExternalDocument/masks@1x/images/Layer-mask-03B6E603-BF6F-4E8E-B115-A1100B91E662.png
  13. BIN test/static/ExternalDocument/masks@1x/images/Layer-mask-1BFFD0E6-6E9F-486E-9986-DDBA05275694.png
  14. BIN test/static/ExternalDocument/masks@1x/images/Layer-mask-58AF78AA-BCCB-4B7D-8193-300E36804529.png
  15. BIN test/static/ExternalDocument/masks@1x/images/Layer-mask-78A4DB47-C8A9-49C1-B2E4-169B042EFD8D.png
  16. BIN test/static/ExternalDocument/masks@1x/images/Layer-mask-BE2E06E1-C704-4741-8D34-610CCEFD41B7.png
  17. BIN test/static/ExternalDocument/masks@1x/images/Layer-mask-E295FDF2-8CFA-4D56-B282-EEE877F81682.png
  18. BIN test/static/ExternalDocument/masks@1x/images/Layer-parentA-35D27058-CA6A-4E69-A554-199C118C4459.png
  19. BIN test/static/ExternalDocument/masks@1x/images/Layer-parentB-CA88FB50-E355-4613-95C6-A5F962F551EC.png
  20. BIN test/static/ExternalDocument/masks@1x/images/Layer-parentC-7A84AEE4-02A6-4CE9-A301-DC6F3A5CE77D.png
  21. BIN test/static/ExternalDocument/masks@1x/images/Layer-parentD-BEFD9E38-0925-487B-AAFE-2FBAFA397AF3.png
  22. BIN test/static/ExternalDocument/masks@1x/images/Layer-parentE-14D768D1-2821-4DEE-8C46-16A8A0904F73.png
  23. BIN test/static/ExternalDocument/masks@1x/images/Layer-parentF-A0FD1F5A-DF42-4D36-B99C-64AF713A4916.png
  24. +419 −0 test/static/ExternalDocument/masks@1x/layers.json
  25. +421 −0 test/static/ExternalDocument/masks@1x/layers.json.js
  26. +6 −0 test/tests/ImporterTest.coffee
@@ -115,17 +115,9 @@ class exports.Importer
layerInfo.frame = info.image.frame
layerInfo.image = Utils.pathJoin(@path, info.image.path)

# If there is a mask on this layer group, take its frame
# If there is a mask on this layer we clip the layer
if info.maskFrame
layerInfo.frame = info.maskFrame
layerInfo.clip = true

# Possible fix for images that have a mask in Sketch
# So if a layer without children has a mask, Sketch imports the full image
# That is whay we then take the image frame over the mask frame again
if info.children.length is 0 and true in _.pluck(superLayer?.superLayers(), "clip")
layerInfo.frame = info.image.frame
layerInfo.clip = false

if layerInfo.kind is "artboard"
layerInfo.frame.x = 0
Binary file not shown.
@@ -0,0 +1,33 @@
{
"BoxC": {
"frame": {
"x": 0,
"y": 0,
"width": 200,
"height": 200
},
"subLayerNames": []
},
"BoxB": {
"frame": {
"x": -100,
"y": -100,
"width": 300,
"height": 300
},
"subLayerNames": [
"BoxC"
]
},
"BoxA": {
"frame": {
"x": 343,
"y": 257,
"width": 400,
"height": 400
},
"subLayerNames": [
"BoxB"
]
}
}
@@ -0,0 +1,90 @@
[
{
"children": [
{
"children": [
{
"children": [],
"id": "08A4C240-563F-43FD-B05F-FE6CAC1DDEEB",
"image": {
"frame": {
"height": 200,
"width": 200,
"x": 243,
"y": 157
},
"path": "images/Layer-BoxC-08A4C240-563F-43FD-B05F-FE6CAC1DDEEB.png"
},
"imageType": "png",
"kind": "group",
"layerFrame": {
"height": 200,
"width": 200,
"x": 243,
"y": 157
},
"maskFrame": null,
"metadata": {
"opacity": 1
},
"name": "BoxC",
"visible": true
}
],
"id": "DEF72836-25A5-4BD3-8B8F-4C41BC3D050E",
"image": {
"frame": {
"height": 300,
"width": 300,
"x": 243,
"y": 157
},
"path": "images/Layer-BoxB-DEF72836-25A5-4BD3-8B8F-4C41BC3D050E.png"
},
"imageType": "png",
"kind": "group",
"layerFrame": {
"height": 300,
"width": 300,
"x": 243,
"y": 157
},
"maskFrame": null,
"metadata": {
"opacity": 1
},
"name": "BoxB",
"visible": true
}
],
"id": "9B5EFFBF-8BA1-4307-836F-971E2E31EF91",
"image": {
"frame": {
"height": 400,
"width": 400,
"x": 343,
"y": 257
},
"path": "images/Layer-BoxA-9B5EFFBF-8BA1-4307-836F-971E2E31EF91.png"
},
"imageType": "png",
"kind": "group",
"layerFrame": {
"height": 400,
"width": 400,
"x": 343,
"y": 257
},
"maskFrame": {
"height": 400,
"width": 400,
"x": 343,
"y": 257
},
"metadata": {
"opacity": 1
},
"name": "BoxA",
"visible": true
}
]
@@ -0,0 +1,92 @@

window.__imported__ = window.__imported__ || {};
window.__imported__["innermasks/layers.json.js"] = [
{
"children": [
{
"children": [
{
"children": [],
"id": "08A4C240-563F-43FD-B05F-FE6CAC1DDEEB",
"image": {
"frame": {
"height": 200,
"width": 200,
"x": 243,
"y": 157
},
"path": "images/Layer-BoxC-08A4C240-563F-43FD-B05F-FE6CAC1DDEEB.png"
},
"imageType": "png",
"kind": "group",
"layerFrame": {
"height": 200,
"width": 200,
"x": 243,
"y": 157
},
"maskFrame": null,
"metadata": {
"opacity": 1
},
"name": "BoxC",
"visible": true
}
],
"id": "DEF72836-25A5-4BD3-8B8F-4C41BC3D050E",
"image": {
"frame": {
"height": 300,
"width": 300,
"x": 243,
"y": 157
},
"path": "images/Layer-BoxB-DEF72836-25A5-4BD3-8B8F-4C41BC3D050E.png"
},
"imageType": "png",
"kind": "group",
"layerFrame": {
"height": 300,
"width": 300,
"x": 243,
"y": 157
},
"maskFrame": null,
"metadata": {
"opacity": 1
},
"name": "BoxB",
"visible": true
}
],
"id": "9B5EFFBF-8BA1-4307-836F-971E2E31EF91",
"image": {
"frame": {
"height": 400,
"width": 400,
"x": 343,
"y": 257
},
"path": "images/Layer-BoxA-9B5EFFBF-8BA1-4307-836F-971E2E31EF91.png"
},
"imageType": "png",
"kind": "group",
"layerFrame": {
"height": 400,
"width": 400,
"x": 343,
"y": 257
},
"maskFrame": {
"height": 400,
"width": 400,
"x": 343,
"y": 257
},
"metadata": {
"opacity": 1
},
"name": "BoxA",
"visible": true
}
]
Binary file not shown.
@@ -0,0 +1,86 @@
{
"mask": {
"frame": {
"x": 150,
"y": 150,
"width": 300,
"height": 300
},
"subLayerNames": []
},
"parentF": {
"frame": {
"x": 772,
"y": 612,
"width": 300,
"height": 300
},
"subLayerNames": [
"mask"
]
},
"parentE": {
"frame": {
"x": 412,
"y": 612,
"width": 300,
"height": 300
},
"subLayerNames": [
"mask"
]
},
"parentD": {
"frame": {
"x": 50,
"y": 612,
"width": 300,
"height": 301
},
"subLayerNames": [
"mask"
]
},
"parentC": {
"frame": {
"x": 770,
"y": 132,
"width": 300,
"height": 300
},
"subLayerNames": [
"mask"
]
},
"parentB": {
"frame": {
"x": 410,
"y": 132,
"width": 300,
"height": 300
},
"subLayerNames": [
"mask"
]
},
"parentA": {
"frame": {
"x": 50,
"y": 132,
"width": 300,
"height": 300
},
"subLayerNames": [
"mask"
]
},
"labels": {
"frame": {
"x": 70,
"y": 60,
"width": 1010,
"height": 530
},
"subLayerNames": []
}
}
Oops, something went wrong.

0 comments on commit d8cabe8

Please sign in to comment.
You can’t perform that action at this time.