Skip to content

Commit

Permalink
fix(padding/spacing): fix some bugs where duplicates are created
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Jul 29, 2022
1 parent 563421c commit 2e29709
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ const setMeasurements = async (
};

for (const node of nodes) {
if(!node) continue;
let surrounding: SurroundingSettings = store.surrounding;

if (!state.detached) {
Expand Down Expand Up @@ -463,7 +464,7 @@ const setMeasurements = async (
Object.keys(Alignments)
.filter((k) => k !== Alignments.CENTER && padding[k])
.forEach((direction: Alignments) => {
removePaddingGroup(node, direction, store.isGlobalGroup);
removePaddingGroup(node, direction, state.isGlobalGroup);

const paddingLine = createPaddingLine({
...settings,
Expand Down
6 changes: 3 additions & 3 deletions src/main/spacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const drawSpacing = async (
labelPattern = '',
labelsOutside = false,
strokeCap = 'NONE',
},
}
) => {
const state = await getState();
const LABEL_OUTSIDE_MARGIN = 4 * (state.labelFontSize / 10);
Expand Down Expand Up @@ -253,7 +253,7 @@ export const drawSpacing = async (
if (cutsVerticalRectPoints) {
if (strokeCap === 'STANDARD') {
spacingGroup.push(
[true, false].map((isFirst) =>
...[true, false].map((isFirst) =>
createStandardCapForSpacing({
line: line1,
isFirst,
Expand Down Expand Up @@ -419,7 +419,7 @@ export const drawSpacing = async (
if (cutsHorizontalRectPoints) {
if (strokeCap === 'STANDARD') {
spacingGroup.push(
[true, false].map((isFirst) =>
...[true, false].map((isFirst) =>
createStandardCapForSpacing({
line: line4,
isHorizontal: true,
Expand Down

0 comments on commit 2e29709

Please sign in to comment.