Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Visually tag duplicate symbols #43

Open
dngrlux opened this issue Jul 29, 2017 · 0 comments
Open

Feature Request: Visually tag duplicate symbols #43

dngrlux opened this issue Jul 29, 2017 · 0 comments

Comments

@dngrlux
Copy link

dngrlux commented Jul 29, 2017

Many thanks for this plugin!

To aid with the symbol de-duping process, it would be helpful to visually tag duplicate symbols to see where they are being used across the document. I understand that one of the duplicates may actually be the preferred version, but it would be easy to manually move this visual tag from one symbol to the adjacent duplicate.

I'd also recommend changing the name of the duplicated symbol to something more unique so that you can filter them out in the lower left Sketch pane. Searching for 'Copy x' gives results of Sketch's 'Rename duplicated layers' preference. You can command-select items in the filtered list and quickly replace them with the preferred version.

I'm not a developer, but with a bunch of trial and error I got this to work in version 11.4 with Sketch Beta 46 (44420). Replacing line 180 in ~/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Symbol Organizer.sketchplugin/Contents/Sketch/functions.js with the code below achieves both:


symbol.setName(thisSymbolName + " DUPLICATE " + duplicateSymbolCount);
var rectShape = MSRectangleShape.alloc().init();
rectShape.frame = MSRect.rectWithRect(NSMakeRect(0, 0, symbol.frame().width(), symbol.frame().height()));
rectLayer = [MSShapeGroup shapeWithPath: rectShape];
rectLayer.name  = '*** DUPLICATE SYMBOL ***';
rectLayer.style().addStylePartOfType(0);
rectLayer.style().fills().firstObject().color = MSColor.colorWithRed_green_blue_alpha(255/255,0/255,0/255,0.6);
symbol.addLayers([rectLayer]);

In the configuration pane, the preference could indicate that duplicates will be visually tagged, or a new preference could be added to separate the renaming from the visual tagging.

If a duplicate is found, the plugin could also test the dimensions of each and indicate a change in the symbol name — i.e. LayerName DUPLICATE 1 (check dimensions). Then the user is informed that they may need to go back and clean up their layout while they are replacing symbols.

I see that you've had some thoughts about this in issue #7, and maybe this could be the next step and elaborated on later.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants