@kolkrabbi/kol-component 0.254.0 → 0.255.0
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.255.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"embla-carousel-react": "^8.6.0",
|
|
27
27
|
"pdfjs-dist": "^6.3.289",
|
|
28
28
|
"react-syntax-highlighter": "^16.1.1",
|
|
29
|
-
"@kolkrabbi/kol-
|
|
30
|
-
"@kolkrabbi/kol-
|
|
29
|
+
"@kolkrabbi/kol-search": "^0.3.0",
|
|
30
|
+
"@kolkrabbi/kol-markdown": "^0.1.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@kolkrabbi/kol-icons": ">=0.22.0",
|
|
@@ -95,6 +95,17 @@ export default function SelectionOverlay({
|
|
|
95
95
|
/* half the rotated box's axis-aligned height — the label hangs below that, centred */
|
|
96
96
|
const rad = (rot * Math.PI) / 180
|
|
97
97
|
const halfBoundsH = (Math.abs(w * Math.sin(rad)) + Math.abs(h * Math.cos(rad))) / 2
|
|
98
|
+
/* …and clear the rotate handle when the box points down (SelectionOverlayLabelClearsRotateHandle,
|
|
99
|
+
* kol-fxr 2026-10-13: at 180° the handle sat on the label's ×). The handle's centre, from the box
|
|
100
|
+
* centre, after the chrome's rotation; if it falls in the label's column below the box, the label
|
|
101
|
+
* hangs under the handle instead. Label width estimated from its text — mono, 12px. */
|
|
102
|
+
const labelText = showLabel ? labelFormatter(box) : ''
|
|
103
|
+
const handleDy = -(h / 2) - ROTATE_OFFSET / zoom + size / 2
|
|
104
|
+
const handleX = -handleDy * Math.sin(rad)
|
|
105
|
+
const handleY = handleDy * Math.cos(rad)
|
|
106
|
+
const labelHalfW = (labelText.length * 7.5 + 12) / 2 / zoom
|
|
107
|
+
const clearsHandle = rotate && handleY > 0 && Math.abs(handleX) < labelHalfW + size / 2
|
|
108
|
+
const labelBelow = Math.max(halfBoundsH, clearsHandle ? handleY + size / 2 : 0)
|
|
98
109
|
|
|
99
110
|
return (
|
|
100
111
|
<>
|
|
@@ -162,7 +173,7 @@ export default function SelectionOverlay({
|
|
|
162
173
|
style={{
|
|
163
174
|
position: 'absolute',
|
|
164
175
|
left: x + w / 2,
|
|
165
|
-
top: y + h / 2 +
|
|
176
|
+
top: y + h / 2 + labelBelow + 6 / zoom,
|
|
166
177
|
/* counter-scale, not just a smaller font: padding, radius and
|
|
167
178
|
* tracking have to stay screen-constant too */
|
|
168
179
|
transform: `translateX(-50%) scale(${1 / zoom})`,
|
|
@@ -179,7 +190,7 @@ export default function SelectionOverlay({
|
|
|
179
190
|
zIndex: 100,
|
|
180
191
|
}}
|
|
181
192
|
>
|
|
182
|
-
{
|
|
193
|
+
{labelText}
|
|
183
194
|
</span>
|
|
184
195
|
)}
|
|
185
196
|
</>
|