Loading ...
Sorry, an error occurred while loading the content.

Re: Problem with visibility style on a group

Expand Messages
  • mikeri@crt.com
    Jon: Just tried display in place of visibility and it look like this will work. I used display:inline for the elements I wanted to show. Is this the
    Message 1 of 13 , Nov 7, 2000
    • 0 Attachment
      Jon:

      Just tried 'display' in place of 'visibility' and it look like this
      will work. I used 'display:inline' for the elements I wanted to show.

      Is this the default for 'display'? The CSS explaination of the
      values for 'display' lists this as the initial value.

      I'm assuming 'display:inline' is what I want when I want to show an
      element or group and 'display:none' is what I want when I want to
      hide an element or group.

      Thanks,
      Michael Rizzo

      --- In svg-developers@egroups.com, "Jon Ferraiolo" <jferraio@a...>
      wrote:
      > Mike,
      > I just glanced through your example, so I'm not sure if this
      addresses your
      > question. But the 'visibility' property from CSS2 has some
      unintuitive
      > behavior. Sometimes it is better to use the 'display' property.
      This is
      > discussed in:
      http://www.w3.org/TR/SVG/painting.html#VisibilityControl
      >
      > Jon
    • mikeri@crt.com
      Aaron: Thanks for the tip. I tried this but it only reversed the problem. Instead of having the green show regardless of the group visibility I suddenly had
      Message 2 of 13 , Nov 7, 2000
      • 0 Attachment
        Aaron:

        Thanks for the tip. I tried this but it only reversed the problem.
        Instead of having the green show regardless of the group visibility I
        suddenly had the hidden blue showing because the group was visible.

        Jon's recommendation (at least in a cursory test) of using
        the 'display' property seems to make my sample work correctly for
        both blue and green groups.

        I used 'display:inline' for the ones I wanted visible
        and 'display:none' for the ones I wanted hidden.

        Thanks,
        Michael Rizzo

        --- In svg-developers@egroups.com, "Aaron Siri" <aaron@a...> wrote:
        > You may be forgetting to set visibility to inherit.
        >
        > For an element, when you turn it back on (make it visible again),
        do the
        > following:
        >
        > element.getStyle().setProperty("visibility","visible");
        > element.getStyle().setProperty("visibility","inherit");
        >
        > That should turn it back on and also make it respect the visibility
        of the
        > parent group.
        >
        > I had the same problem and this fixed it.
        >
        > -Aaron
      • Jon Ferraiolo
        Yes, the initial value for the display property (http://www.w3.org/TR/SVG/painting.html#DisplayProperty) is inline . What you are doing is correct. Jon
        Message 3 of 13 , Nov 8, 2000
        • 0 Attachment
          Yes, the initial value for the 'display' property
          (http://www.w3.org/TR/SVG/painting.html#DisplayProperty) is 'inline'. What
          you are doing is correct.

          Jon

          At 08:20 PM 11/7/00 +0000, you wrote:
          >Jon:
          >
          >Just tried 'display' in place of 'visibility' and it look like this
          >will work. I used 'display:inline' for the elements I wanted to show.
          >
          >Is this the default for 'display'? The CSS explaination of the
          >values for 'display' lists this as the initial value.
          >
          >I'm assuming 'display:inline' is what I want when I want to show an
          >element or group and 'display:none' is what I want when I want to
          >hide an element or group.
          >
          >Thanks,
          >Michael Rizzo
          >
          >--- In svg-developers@egroups.com, "Jon Ferraiolo" <jferraio@a...>
          >wrote:
          > > Mike,
          > > I just glanced through your example, so I'm not sure if this
          >addresses your
          > > question. But the 'visibility' property from CSS2 has some
          >unintuitive
          > > behavior. Sometimes it is better to use the 'display' property.
          >This is
          > > discussed in:
          >http://www.w3.org/TR/SVG/painting.html#VisibilityControl
          > >
          > > Jon
          >
          >
          >
          >
        • Richard Pearman
          From: ... Isn t this because the elements visibility setting IS overriding the group setting as you thought it should? I m not at all sure
          Message 4 of 13 , Nov 9, 2000
          • 0 Attachment
            From: <mikeri@...>

            > I thought the group visibility setting would override the contained
            > element setting but it doesn't appear to work that way.
            >
            > I've boiled it down to this example:
            > *******************************************************************
            > <svg>
            > <circle id='r1' cx='10' cy='10' r='5' style='fill:gray;
            > opacity:0.5' />
            > <circle id='r2' cx='20' cy='10' r='5' style='fill:gray;
            > opacity:0.5' />
            > <circle id='r3' cx='30' cy='10' r='5' style='fill:gray;
            > opacity:0.5' />
            > <circle id='r4' cx='10' cy='40' r='5' style='fill:gray;
            > opacity:0.5' />
            > <circle id='r5' cx='10' cy='50' r='5' style='fill:gray;
            > opacity:0.5' />
            > <circle id='r6' cx='10' cy='60' r='5' style='fill:gray;
            > opacity:0.5' />
            >
            > <g id='blue-circles' style='visibility:visible'>
            > <circle id='b1' cx='10' cy='10' r='5' style='fill:blue;
            > visibility:visible' />
            > <circle id='b2' cx='20' cy='10' r='5' style='fill:blue;
            > visibility:hidden' />
            > <circle id='b3' cx='30' cy='10' r='5' style='fill:blue' />
            > </g>
            >
            > <g id='green-circles' style='visibility:hidden'>
            > <circle id='g1' cx='10' cy='40' r='5' style='fill:green;
            > visibility:visible' />
            > <circle id='g2' cx='10' cy='50' r='5' style='fill:green;
            > visibility:hidden' />
            > <circle id='g3' cx='10' cy='60' r='5' style='fill:green' />
            > </g>
            > <svg>
            > *******************************************************************
            >
            > The gray dots are reference points. I expect to see the first and
            > third blue dots. However, I should not see any green dots because
            > the 'green-circles' group is hidden but the first dot is shown.
            >
            > Is this correct or a bug?

            Isn't this because the elements visibility setting IS overriding the group
            setting as you thought it should?

            I'm not at all sure what you're trying to do here, it doesn't seem to make
            that much sense (but I realise this is a boiled down example and the full
            version may make more sense).

            What's the difference between visibility and display or do these both do the
            same thing?

            Richard Pearman http://www.nucleus.com/~richardp/
          • Jon Ferraiolo
            ... Look at http://www.w3.org/TR/SVG/painting.html#VisibilityControl. That explains the differences between visibility and display with regard to SVG. Jon
            Message 5 of 13 , Nov 9, 2000
            • 0 Attachment
              At 10:08 AM 11/9/00 -0700, you wrote:
              >What's the difference between visibility and display or do these both do the
              >same thing?
              >
              >Richard Pearman http://www.nucleus.com/~richardp/


              Look at http://www.w3.org/TR/SVG/painting.html#VisibilityControl. That
              explains the differences between 'visibility' and 'display' with regard to SVG.

              Jon
            Your message has been successfully submitted and would be delivered to recipients shortly.