-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: FixedLayout not respected after triggerLayout
#10146
Comments
FixedLayout only guarantees the initial size, and the size can be actively updated later through trigger. I don't know if this is intentional. import { LayoutStrategy, classRegistry } from "fabric";
export class FixedLayoutA extends LayoutStrategy {
static readonly type = "fixed-a";
shouldPerformLayout() {
return false;
}
}
classRegistry.setClass(FixedLayoutA); import type { FabricObject, StrictLayoutContext } from "fabric";
import { LayoutStrategy, Point, classRegistry } from "fabric";
const LAYOUT_TYPE_IMPERATIVE = "imperative";
export class FixedLayoutB extends LayoutStrategy {
static readonly type = "fixed-b";
calcBoundingBox(_: FabricObject[], context: StrictLayoutContext) {
if (context.type === LAYOUT_TYPE_IMPERATIVE && context.overrides) return context.overrides;
const { width, height } = context.target;
const center = context.target.getRelativeCenterPoint();
const size = new Point(width, height);
return { center, size };
}
}
classRegistry.setClass(FixedLayoutB); |
Fixed Layout should have group width and height property win over children size. That is what i remember. |
Thank you both, for your replies! @zhe-he , the The Is As @asturur noted, I expected fixed Layout to have the group width and height property win over children size. |
@drinkspiller |
I didn't have time to look at this issue, to me it make still think of a bug |
Thank you! |
This needs to be fixed in the core library anyway |
CheckList
Version
6.0.2
In What environments are you experiencing the problem?
Chrome
Node Version (if applicable)
None
Link To Reproduction
https://codepen.io/drinkspiller/pen/QWXoYzr?editors=0010
Steps To Reproduce
width: 100, height: 100
) and configure it to useFixedLayout
.width: 500, height: 25
);Expected Behavior
The
FixedLayout
docs note that when using this LayoutStrategy, "Layout will keep target’s initial size."I expected the group to remain 100x100 and for its wider child to extend beyond the group's bound similar to CSS'
overflow: visible
, along the lines of this html/css exampleActual Behavior
triggerLayout
, the child does extend beyond the parent, but only a little bit — the full width of the child is not displayed (demo)triggerLayout()
is called, the Group, which was initialized withFixedLayout
, seems to act as if it has reverted toFitContentLayout
(demo) (note the group's height is no longer the initial value of 100)Error Message & Stack Trace
No response
The text was updated successfully, but these errors were encountered: