Skip to content

Commit

Permalink
fix: rotation of order icon on title table head (#689)
Browse files Browse the repository at this point in the history
* fix: rotation of order icon on title table head

* fix: cleanup code

* fix: format code
  • Loading branch information
reld authored Nov 9, 2021
1 parent e712c3a commit 4351d9e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
Binary file not shown.
Binary file modified packages/generator-sketch/sketch/symbol_database.sqlite
Binary file not shown.
21 changes: 18 additions & 3 deletions packages/generator-sketch/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,24 @@ module.exports = {
}
if (/^Table/.test(symbol.name)) {
symbol.groupLayout = undefined;
symbol.layers.forEach(
(l) => (l.resizingConstraint = TOP_LEFT_FIXED_SIZE)
);
symbol.layers.forEach((l) => {
if ('layers' in l) {
l.layers.forEach((l) => {
if ('layers' in l) {
l.layers.forEach((l) => {
if ('layers' in l) {
l.layers.forEach((l) => {
if (l.name === 'svg') {
l.rotation = -45;
}
});
}
});
}
});
}
l.resizingConstraint = TOP_LEFT_FIXED_SIZE;
});
}
if (/^Tag/.test(symbol.name)) {
symbol.layers[0].resizingConstraint = TOP_LEFT_FIXED_SIZE;
Expand Down
39 changes: 39 additions & 0 deletions packages/generator-sketch/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,48 @@ function setResizingConstraints(symbol, ...predicateActionPairs) {
}
}

const searchObject = function (
object,
matchCallback,
currentPath,
result,
searched
) {
currentPath = currentPath || '';
result = result || [];
searched = searched || [];
if (searched.indexOf(object) !== -1 && object === Object(object)) {
return;
}
searched.push(object);
if (matchCallback(object)) {
result.push({ path: currentPath, value: object });
}
try {
if (object === Object(object)) {
for (var property in object) {
if (property.indexOf('$') !== 0) {
searchObject(
object[property],
matchCallback,
currentPath + '.' + property,
result,
searched
);
}
}
}
} catch (e) {
console.log(object);
throw e;
}
return result;
};

module.exports = {
findLayer,
findLayers,
searchObject,
printSymbolStructure,
setResizingConstraints,
Resize,
Expand Down

0 comments on commit 4351d9e

Please sign in to comment.