【问题标题】:How can I redraw my degrafa background when scrolling?滚动时如何重绘我的 degrafa 背景?
【发布时间】:2008-11-19 18:32:20
【问题描述】:

我正在使用具有 degrafa 背景的画布,到目前为止一切都很好。

但是,在滚动时,背景(degrafa 网格)不会被重绘。 在代码中,背景笔画与容器高度相关联。即使滚动,容器高度也不会改变。

如何获取整个区域的高度,以便为我的 degrafa 背景设置新高度?

看起来像这样:

 <mx:Canvas id="blackBoard"
                width="100%" 
                height="100%" 
                x="0" 
                y="0" 
                backgroundColor="#444444"
                clipContent="true">

    <!-- Degrafa Surface   -->
    <degrafa:Surface id="boardSurfaceContainer">
            <degrafa:strokes>
                <degrafa:SolidStroke    id="whiteStroke"
                                        color="#EEE"
                                        weight="1"
                                        alpha=".2"/>
            </degrafa:strokes>

            <!-- Grid drawing -->
            <degrafa:GeometryGroup id="grid">
                <degrafa:VerticalLineRepeater   count="{blackBoard.width / ApplicationFacade.settings.GRID_SIZE}"
                                                stroke="{whiteStroke}"
                                                x="0"
                                                y="0"
                                                y1="{blackBoard.height}"
                                                offsetX="0"
                                                offsetY="0"
                                                moveOffsetX="{ApplicationFacade.settings.GRID_SIZE}"
                                                moveOffsetY="0"/>

                <degrafa:HorizontalLineRepeater count="{blackBoard.height / ApplicationFacade.settings.GRID_SIZE}"
                                                stroke="{whiteStroke}"
                                                x="0"
                                                y="0"
                                                x1="{blackBoard.width}"
                                                offsetX="0"
                                                offsetY="0"
                                                moveOffsetX="0"
                                                moveOffsetY="{ApplicationFacade.settings.GRID_SIZE}"/>

            </degrafa:GeometryGroup>          

        </degrafa:Surface>

【问题讨论】:

    标签: apache-flex scroll degrafa


    【解决方案1】:

    我只需要在 degrafa 属性绑定中使用滚动位置

                <degrafa:VerticalLineRepeater   count="{(blackBoard.width + blackBoard.horizontalScrollPosition)/ ApplicationFacade.settings.GRID_SIZE}"
                                                stroke="{whiteStroke}"
                                                x="0"
                                                y="0"
                                                y1="{blackBoard.height + blackBoard.verticalScrollPosition}"
                                                offsetX="0"
                                                offsetY="0"
                                                moveOffsetX="{ApplicationFacade.settings.GRID_SIZE}"
                                                moveOffsetY="0"/>
    

    【讨论】:

      猜你喜欢
      • 2018-10-02
      • 1970-01-01
      • 2010-11-27
      • 2019-10-19
      • 2012-07-03
      • 1970-01-01
      • 1970-01-01
      • 2012-04-03
      • 2020-04-20
      相关资源
      最近更新 更多