Skip to content

Commit eeb83a6

Browse files
committed
Merge pull request livecode#3886 from livecodeian/bugfix-17347
[[ Bug 17347 ]] Fix browser widget clipped after card resize
2 parents 705f049 + 74cd4e8 commit eeb83a6

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

docs/notes/bugfix-17347.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Browser: fix browser appearing clipped after card resize.

engine/src/card.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,35 @@ Exec_stat MCCard::relayer(MCControl *optr, uint2 newlayer)
20272027
return ES_NORMAL;
20282028
}
20292029

2030+
////////////////////////////////////////////////////////////////////////////////
2031+
2032+
struct ViewportChangedVisitor: public MCObjectVisitor
2033+
{
2034+
MCRectangle m_viewport_rect;
2035+
2036+
ViewportChangedVisitor(const MCRectangle &p_viewport_rect)
2037+
: m_viewport_rect(p_viewport_rect)
2038+
{
2039+
}
2040+
2041+
bool OnObject(MCObject *p_object)
2042+
{
2043+
p_object->viewportgeometrychanged(m_viewport_rect);
2044+
return true;
2045+
}
2046+
};
2047+
2048+
void MCCard::geometrychanged(const MCRectangle &p_rect)
2049+
{
2050+
MCObject::geometrychanged(p_rect);
2051+
2052+
// notify children of viewport change
2053+
ViewportChangedVisitor t_visitor(p_rect);
2054+
visit_children(kMCObjectVisitorHeirarchical, 0, &t_visitor);
2055+
}
2056+
2057+
////////////////////////////////////////////////////////////////////////////////
2058+
20302059
MCCard *MCCard::findname(Chunk_term type, MCNameRef inname)
20312060
{
20322061
// MCNewAutoNameRef t_name;
@@ -2826,6 +2855,8 @@ void MCCard::resize(uint2 width, uint2 height)
28262855
rect.x = rect.y = 0;
28272856
rect.width = width;
28282857
rect.height = height;
2858+
2859+
geometrychanged(rect);
28292860
}
28302861

28312862
MCImage *MCCard::createimage()

engine/src/card.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ class MCCard : public MCObject
108108
virtual void relayercontrol_remove(MCControl *control);
109109
virtual void relayercontrol_insert(MCControl *control, MCControl *target);
110110

111+
virtual void geometrychanged(const MCRectangle &p_rect);
112+
111113
virtual void scheduledelete(bool p_is_child);
112114

113115
void draw(MCDC *dc, const MCRectangle &dirty, bool p_isolated);

0 commit comments

Comments
 (0)