调整包含路径的组大小时出现问题

发布于 2024-11-09 03:52:47 字数 1997 浏览 0 评论 0原文

我一直在尝试为通用应用程序构建一个非常简单的页脚,当用户将鼠标悬停在其上并适应应用程序的宽度时,该页脚会“增长”。这个简单的代码片段似乎可以解决问题:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"
             currentState="normal">

    <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                private const _lipWidth:Number = 8.64;

            ]]>
        </fx:Script>

        <s:states>
            <s:State name="other"/>
            <s:State name="normal"/>
        </s:states>

    <s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'"> 
        <s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other"
                data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
            <s:fill>
                <s:SolidColor color="blue"/>
            </s:fill>
        </s:Path>

        <s:Path  id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal"
                 data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
            <s:fill>
                <s:SolidColor color="gray"/>
            </s:fill>
        </s:Path>
    </s:Group>
</s:Application>

但是,如果我尝试向 LargeRibbon 路径添加阴影,

<s:filters>
    <s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2"/>
</s:filters>

事情就会停止工作 - 更具体地说,如果您启动应用程序,将鼠标悬停在页脚上,放大应用程序,然后再次将鼠标悬停在页脚上LargeRibbon 似乎无法正确调整大小。我很想知道为什么会这样,更一般地说,我会喜欢您能提供的关于这个组/路径组合是否有意义的任何建议。

谢谢

I've been trying to build a very simple footer for a generic app that "grows" when the user hovers over it and adapts to the app's width. This simple snippet seems to do the trick:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"
             currentState="normal">

    <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                private const _lipWidth:Number = 8.64;

            ]]>
        </fx:Script>

        <s:states>
            <s:State name="other"/>
            <s:State name="normal"/>
        </s:states>

    <s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'"> 
        <s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other"
                data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
            <s:fill>
                <s:SolidColor color="blue"/>
            </s:fill>
        </s:Path>

        <s:Path  id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal"
                 data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
            <s:fill>
                <s:SolidColor color="gray"/>
            </s:fill>
        </s:Path>
    </s:Group>
</s:Application>

However, if I try to add a shadow to the LargeRibbon path

<s:filters>
    <s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2"/>
</s:filters>

things stop working - more specifically if you start the app, hover over the footer, enlarge the app, and then hover over the footer again LargeRibbon does not seem to properly resize. Would love to know why this is and more generally would love any advice you can spare on whether this group / path combination makes sense or not.

thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水水月牙 2024-11-16 03:52:47

这段代码工作正常:

<fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            private const _lipWidth:Number = 8.64;

        ]]>
    </fx:Script>

    <s:states>
        <s:State name="other"/>
        <s:State name="normal"/>
    </s:states>

<s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'"> 
    <s:filters.other>
        <s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2" />
    </s:filters.other>
    <s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other"
            data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
        <s:fill>
            <s:SolidColor color="blue"/>
        </s:fill>
    </s:Path>

    <s:Path  id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal"
             data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
        <s:fill>
            <s:SolidColor color="gray"/>
        </s:fill>
    </s:Path>
</s:Group>

为什么它不能直接将过滤器放置在LargeRibbon中,我建议这是某种位图缓存问题。

This code works fine:

<fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            private const _lipWidth:Number = 8.64;

        ]]>
    </fx:Script>

    <s:states>
        <s:State name="other"/>
        <s:State name="normal"/>
    </s:states>

<s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'"> 
    <s:filters.other>
        <s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2" />
    </s:filters.other>
    <s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other"
            data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
        <s:fill>
            <s:SolidColor color="blue"/>
        </s:fill>
    </s:Path>

    <s:Path  id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal"
             data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
        <s:fill>
            <s:SolidColor color="gray"/>
        </s:fill>
    </s:Path>
</s:Group>

What about the reason why it is not working with placing filter in LargeRibbon directly I suggest it is some kind of bitmap caching issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文