@stefan.inc/feedback-engine 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/cardLayout.ts +7 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stefan.inc/feedback-engine",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "In-app feedback for Svelte and React: point at a component, write what should change, and export its name, file:line, and data for an agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
package/src/core/cardLayout.ts
CHANGED
|
@@ -106,10 +106,9 @@ function arrange(
|
|
|
106
106
|
references: Frame[],
|
|
107
107
|
): Arrangement {
|
|
108
108
|
const { margin, column, gutter, spacing, rightColumnPenalty, crossingPenalty, watermark } = cards;
|
|
109
|
-
const top = margin + watermark + spacing;
|
|
110
109
|
const shot = {
|
|
111
110
|
x: columns === 'right' ? margin : margin + column + gutter,
|
|
112
|
-
y:
|
|
111
|
+
y: margin,
|
|
113
112
|
width: screen.width,
|
|
114
113
|
height: screen.height,
|
|
115
114
|
};
|
|
@@ -120,16 +119,16 @@ function arrange(
|
|
|
120
119
|
const midY = (index: number) => moved[index]!.y + moved[index]!.height / 2;
|
|
121
120
|
const placed: Card[] = moved.map(() => ({ isLeft: true, origin: { x: 0, y: 0 } }));
|
|
122
121
|
const paths: Point[][] = [];
|
|
123
|
-
const environment = { x: columns === 'left' ? margin : rightX, y:
|
|
124
|
-
const underEnvironment =
|
|
125
|
-
let nextLeft = columns === 'left' ? underEnvironment :
|
|
122
|
+
const environment = { x: columns === 'left' ? margin : rightX, y: margin };
|
|
123
|
+
const underEnvironment = margin + environmentHeight + spacing * 2;
|
|
124
|
+
let nextLeft = columns === 'left' ? underEnvironment : margin;
|
|
126
125
|
let nextRight = underEnvironment;
|
|
127
126
|
let cost = 0;
|
|
128
127
|
let crossed = 0;
|
|
129
128
|
const order = moved.map((_, index) => index).toSorted((a, b) => midY(a) - midY(b) || a - b);
|
|
130
129
|
for (const index of order) {
|
|
131
130
|
const target = moved[index]!;
|
|
132
|
-
const desired = Math.max(midY(index) - heights[index]! / 2,
|
|
131
|
+
const desired = Math.max(midY(index) - heights[index]! / 2, margin);
|
|
133
132
|
const options: Card[] = [];
|
|
134
133
|
if (columns !== 'right') options.push({ isLeft: true, origin: { x: margin, y: Math.max(desired, nextLeft) } });
|
|
135
134
|
if (columns !== 'left') options.push({ isLeft: false, origin: { x: rightX, y: Math.max(desired, nextRight) } });
|
|
@@ -161,7 +160,7 @@ function arrange(
|
|
|
161
160
|
shot,
|
|
162
161
|
cards: placed,
|
|
163
162
|
environment,
|
|
164
|
-
watermark: { isLeft: columns === 'left', origin: { x: environment.x, y: margin } },
|
|
163
|
+
watermark: { isLeft: columns === 'left', origin: { x: environment.x, y: (margin - watermark) / 2 } },
|
|
165
164
|
size: { width: columns === 'left' ? shot.x + shot.width + margin : rightX + column + margin, height },
|
|
166
165
|
cost,
|
|
167
166
|
crossings: crossed,
|
|
@@ -171,7 +170,7 @@ function arrange(
|
|
|
171
170
|
/**
|
|
172
171
|
* Where the image export puts each item's card. Cards go in the column whose path to the target costs least: its
|
|
173
172
|
* length, `rightColumnPenalty` points for the right column, and `crossingPenalty` for each other box or earlier path
|
|
174
|
-
* it crosses, as level with the target as the cards above allow. The watermark
|
|
173
|
+
* it crosses, as level with the target as the cards above allow. The watermark sits in the top margin, centered in it,
|
|
175
174
|
* in the outer corner of the environment's column. The environment sits at the top of the right column, and
|
|
176
175
|
* right-column cards start below it. When one column holds the
|
|
177
176
|
* environment and every card with no crossing and no taller image, the image drops the other column and keeps only a
|