Scaling in flex - exclude some children?

2019-05-30 08:28发布

i'm trying to build a webmap application in flex. for ths, 've got a fxg-file which represents the maps. it's in a also there are some elements, like POIs, text et cetera in this group. i zoom the with scaleX and scaleY, this works just fine for the map.

but the problem is: ALL childen zoom also. i don't want this. they should stay the same place on the map and the same size.

heres some code the as function

<fx:Script>

    <![CDATA[
        import mx.skins.Border; 
        [Bindable]
        public var hoehe:Number = 1;
        [Bindable]
        public var breite:Number = 1;

        protected function zoom_changeHandler(event:Event):void
        {
            hoehe = zoom.value;
            breite =  zoom.value;
        }
    ]]>
</fx:Script> 

and the

    <s:Scroller width="100%" height="100%"   baseline="10">

<s:Group scaleX="{breite}" scaleY="{hoehe}"  id="mapView" > <!-- zum zoomen -->

    <s:Group horizontalCenter="0" > <!-- Enthält alle Objekte -->
    <images:karte  id="kartePanel" height="630" width="430" />
    <images:akw   id="akw1" scaleX="0.2" scaleY="0.2" top="158" left="190" />       
    <components:akwView x="154" y="131" resizeMode="scale">
    </components:akwView>
    </s:Group>
</s:Group>
</s:Scroller>

componentsLakwView contains some labels etc. this should not be resized?

标签: flex map scaling
2条回答
别忘想泡老子
2楼-- · 2019-05-30 08:58

You can negate zoom for those children with inverse value - for example, if you apply zoom 2.0 to parent, apply 1/2.0 = 0.5 scale to those children, and their size will be constant.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-05-30 08:58

You should separate your map application to several layers, each layer contain a specific set of items. For example, the bottom layer is the map only, one layer for text, one for POIs... So you only need to scale on map layer and adjust the position of items on the other layers. This approach also gives you advantage of hiding some layers if not necessary.

查看更多
登录 后发表回答