-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@import 'libs/common.js' | ||
|
||
var onRun = function(context){ | ||
const selection = context.selection, | ||
doc = context.document, | ||
page = [doc currentPage], | ||
artboard = [page currentArtboard], | ||
g_layers = [artboard layers], | ||
MAX_COUNT = [selection count]; | ||
|
||
if (MAX_COUNT > 0){ | ||
processAllLayers(g_layers,function(layer){ | ||
[layer setIsVisible:false]; | ||
}); | ||
} | ||
|
||
function processAllLayers(layers,callback) { | ||
for (var i = 0; i < [layers count]; i++) { | ||
var layer = [layers objectAtIndex:i]; | ||
var isSkip = [selection indexOfObject:layer] < MAX_COUNT | ||
if (isGroup(layer)) { | ||
if (isSkip) continue; | ||
processAllLayers([layer layers], callback); | ||
}else{ | ||
if (!isSkip) callback(layer); | ||
} | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"name": "Handy Tools", | ||
"description": "Some handy tools for Sketch", | ||
"author": "webpatch", | ||
"homepage": "https://github.com/webpatch/Handy-Tools", | ||
"version": 1.0, | ||
"identifier": "com.hikiny.sketch.handytools", | ||
"compatibleVersion": 3, | ||
"commands": [ | ||
{ | ||
"name": "Algin to...", | ||
"identifier": "algin", | ||
"shortcut": "ctrl shift a", | ||
"script": "algin.js", | ||
"handler": "onRun" | ||
}, | ||
{ | ||
"name": "Space...", | ||
"identifier": "space", | ||
"shortcut": "ctrl shift s", | ||
"script": "space.js", | ||
"handler": "onRun" | ||
}, | ||
{ | ||
"name": "Hidden others", | ||
"identifier": "hideOthers", | ||
"shortcut": "", | ||
"script": "hidden_others.js", | ||
"handler": "onRun" | ||
}, | ||
{ | ||
"name": "Unhidden all", | ||
"identifier": "unhiddenAll", | ||
"shortcut": "", | ||
"script": "unhidden_all.js", | ||
"handler": "onRun" | ||
}, | ||
{ | ||
"name": "Unhidden all Artboards", | ||
"identifier": "unhiddenAllArtboards", | ||
"shortcut": "", | ||
"script": "unhidden_all_artboard.js", | ||
"handler": "onRun" | ||
} | ||
], | ||
"menu": { | ||
"items": [ | ||
"algin", | ||
"space", | ||
{ | ||
"title": "Hidden & Unhidden", | ||
"items": [ | ||
"hideOthers", | ||
"unhiddenAll", | ||
"unhiddenAllArtboards" | ||
] | ||
} | ||
], | ||
"title": "Handy Tools" | ||
} | ||
} |