ABLX
ABLX

Reputation: 736

flex scroller cuts content

got a little flex application where the content is zoomable. first of all some code

<s:Scroller  verticalScrollPolicy="on"  width="100%" height="100%">



<s:Group scaleX="{breite}" scaleY="{hoehe}" 

         id="mapView" > <!-- zum zoomen -->

    <s:Group horizontalCenter="0"  id="kartePanel"  verticalCenter="0">
    <images:karte  height="630" width="430"   />


        <components:akwOnMap data="{biblis}" verticalCenter="{biblis.y}" horizontalCenter="{biblis.x}" 
                             scaleY="{negate}" scaleX="{negate}" toolTip="{biblis.name}"/>



        <components:akwOnMap data="{akw2}" verticalCenter="{akw2.y}" horizontalCenter="{akw2.x}" 
                             scaleY="{negate}" scaleX="{negate}" toolTip="{akw2.name}"/>

            <components:akwView scaleX="{negate}" data="{akw2}" scaleY="{negate}" verticalCenter="20" horizontalCenter="{80}" >
        </components:akwView> 
    </s:Group>
</s:Group>
</s:Scroller>

The zoom just works fine by changing the value from 1 up to 3 with a slider. Midpoint of the zoom is the center of the container (map).

My problem: when i zoom, the scroller cuts a part of the groups. it zooms out of the window?!

Upvotes: 0

Views: 573

Answers (1)

ABLX
ABLX

Reputation: 736

private function checkScrolling():void

{


var imgWidth:Number = mapView.width * mapView.scaleX;
    var imgHeight:Number = mapView.height * mapView.scaleY;

if (mapGroup.contentWidth < imgWidth ||
    mapGroup.contentHeight < imgHeight)
{
    var excessW:Number = imgWidth - mapGroup.contentWidth;
    var excessH:Number = imgHeight - mapGroup.contentHeight;
    mapGroup.setContentSize(imgWidth, imgHeight);
    /*
    if (scroller.horizontalScrollBar)
    {
        scroller.horizontalScrollBar.minimum = -excessW;
        scroller.horizontalScrollBar.maximum = excessW;
        mapGroup.horizontalScrollPosition = 0; 
    }
    */
    if (scroller.verticalScrollBar)
    {
        scroller.verticalScrollBar.minimum = -excessH;
        scroller.verticalScrollBar.maximum = excessH;
        mapGroup.verticalScrollPosition = 0;
    }

this just works fine.

Upvotes: 1

Related Questions