Handle für Y-Grösse des Puffers funktinoierte nicht korrekt.

This commit is contained in:
Michael Stangl
2026-04-27 12:12:08 +02:00
parent 36e2d81843
commit e70af5f548
2 changed files with 13 additions and 10 deletions
+5 -2
View File
@@ -62,11 +62,14 @@ export class PufferShapeUtil extends ShapeUtil<PufferShape> {
{ handle }: { handle: TLHandle } { handle }: { handle: TLHandle }
): TLShapePartial<PufferShape> | void { ): TLShapePartial<PufferShape> | void {
if (handle.id === 'top') { if (handle.id === 'top') {
const newH = Math.min(CFG.maxH, Math.max(CFG.minH, shape.props.h - handle.y)) // Bottom edge stays fixed; compute new height from mouse page position
const bottom = shape.y + shape.props.h
const mouseY = this.editor.inputs.currentPagePoint.y
const newH = Math.min(CFG.maxH, Math.max(CFG.minH, bottom - mouseY))
return { return {
id: shape.id, id: shape.id,
type: 'puffer', type: 'puffer',
y: shape.y + (shape.props.h - newH), y: bottom - newH,
props: { ...shape.props, h: newH }, props: { ...shape.props, h: newH },
} }
} }
+8 -8
View File
@@ -2,17 +2,17 @@
* Zentrale Konfiguration für alle Custom Shapes. * Zentrale Konfiguration für alle Custom Shapes.
* Defaults, Minima und Maxima an einer Stelle gepflegt. * Defaults, Minima und Maxima an einer Stelle gepflegt.
*/ */
// Angaben in cm
export const PUFFER_CONFIG = { export const PUFFER_CONFIG = {
// Defaults // Defaults
defaultW: 120, defaultW: 240,
defaultH: 60, defaultH: 150,
// Minima // Minima
minW: 20, minW: 240,
minH: 20, minH: 150,
// Maxima // Maxima
maxW: 500, maxW: 4000,
maxH: 300, maxH: 20000,
} }
export const KREISEL_CONFIG = { export const KREISEL_CONFIG = {
@@ -20,7 +20,7 @@ export const KREISEL_CONFIG = {
defaultAbstand: 200, defaultAbstand: 200,
defaultRadius: 80, defaultRadius: 80,
// Minima // Minima
minAbstand: 20, minAbstand: 180,
// Maxima // Maxima
maxAbstand: 4000, maxAbstand: 4000,
} }