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

clip-path

Expand Messages
  • josiahjohnston
    Is there a way to set an element to use a clip-path other than I need to set a clip-path by anything besides its
    Message 1 of 7 , Nov 8, 2002
    • 0 Attachment
      Is there a way to set an element to use a clip-path other than
      <... clip-path="url(#clipPathName)" .../>

      I need to set a clip-path by anything besides its name. Any suggestions?
    • Jim Ley
      josiahjohnston wrote in message news:aqgs1e+30as@eGroups.com... ... suggestions? I think the suggestion is you explain the
      Message 2 of 7 , Nov 8, 2002
      • 0 Attachment
        "josiahjohnston" <johnstonjo@...> wrote in message
        news:aqgs1e+30as@......
        > Is there a way to set an element to use a clip-path other than
        > <... clip-path="url(#clipPathName)" .../>
        >
        > I need to set a clip-path by anything besides its name. Any
        suggestions?

        I think the suggestion is you explain the reason why you need that, and
        we'll come up with a solution... It's always best when asking your
        question to actually ask for help with your actual problem, and not with
        a solution you've decided on.

        Jim.
      • josiahjohnston
        ok. i didn t want to get too complicated, but here s the whole problem. I have this class called toolBox. It instantiates a g element (internally) called
        Message 3 of 7 , Nov 8, 2002
        • 0 Attachment
          ok. i didn't want to get too complicated, but here's the whole problem.
          I have this class called toolBox. It instantiates a 'g' element
          (internally) called GUIboxContainer. GUIboxContainer needs boundaries
          that do not allow things inside GUIboxContainer to display outside.
          clipPath seems like it should work. I need the clipPath boundaries of
          GUIboxContainer to be set during construction of toolBox.

          The strategy I tried was to have a piece of text like so:

          toolBox.prototype.GUIboxClipPathText =
          '<clipPath id="GUIboxClipPath" clipPathUnits="userSpaceOnUse">' +
          '
          <rect width="{$width}" height="{$height}"/>' +
          '</clipPath>';

          that was used in my function that makes GUIboxContainer to instantiate
          it like so

          GUIboxContainer.appendChild( this.textToSVG(this.GUIboxClipPathText) );

          then I bind it to GUIboxContainer like this:

          GUIboxContainer.setAttributeNS(null, "clip-path", "url(#GUIboxClipPath)");

          I guess I could make a unique ID for the clipPath in every instance of
          the class, but I was hoping to avoid that solution by finding another
          way to bind a clipPath to an element. I dislike using global
          references as habit because they leave loose ends. I wanted everything
          relatively neatly packaged and contained in the class.
          I'm getting the impression SVG does not lend itself well to OOP. At
          least not in a way I'm accustomed to.

          --- In svg-developers@y..., "Jim Ley" <jim@j...> wrote:
          >
          > "josiahjohnston" <johnstonjo@g...> wrote in message
          > news:aqgs1e+30as@e...
          > > Is there a way to set an element to use a clip-path other than
          > > <... clip-path="url(#clipPathName)" .../>
          > >
          > > I need to set a clip-path by anything besides its name. Any
          > suggestions?
          >
          > I think the suggestion is you explain the reason why you need that, and
          > we'll come up with a solution... It's always best when asking your
          > question to actually ask for help with your actual problem, and not with
          > a solution you've decided on.
          >
          > Jim.
        • Jim Ley
          josiahjohnston wrote in message news:aqh0nd+5g4e@eGroups.com... ... I know of no other, and as a unique ID is trivial to
          Message 4 of 7 , Nov 8, 2002
          • 0 Attachment
            "josiahjohnston" <johnstonjo@...> wrote in message
            news:aqh0nd+5g4e@......

            > I guess I could make a unique ID for the clipPath in every instance of
            > the class, but I was hoping to avoid that solution by finding another
            > way to bind a clipPath to an element.

            I know of no other, and as a unique ID is trivial to implement, I really
            do not understand the problem javascript is very poor for OOP; it's
            extremely slow, and not true OO anyway why bother?

            > I'm getting the impression SVG does not lend itself well to OOP. At
            > least not in a way I'm accustomed to.

            Well, that might have something to do with it being a mark-up language?

            Jim.
          • josiahjohnston
            ... My boss wants me to. I had similar objections initially, but I m going along now. It ...works. And I don t know of another way to make what he wants. ...
            Message 5 of 7 , Nov 8, 2002
            • 0 Attachment
              > > I guess I could make a unique ID for the clipPath in every instance of
              > > the class, but I was hoping to avoid that solution by finding another
              > > way to bind a clipPath to an element.
              >
              > I know of no other, and as a unique ID is trivial to implement, I really
              > do not understand the problem javascript is very poor for OOP; it's
              > extremely slow, and not true OO anyway why bother?

              My boss wants me to. I had similar objections initially, but I'm going
              along now. It ...works. And I don't know of another way to make what
              he wants.

              > > I'm getting the impression SVG does not lend itself well to OOP. At
              > > least not in a way I'm accustomed to.
              >
              > Well, that might have something to do with it being a mark-up language?

              yup.
            • Kevin Lindsey
              Josiah, ... You may want to look into using an svg element since it creates an implied clipping path. You GUIBox might look like this:
              Message 6 of 7 , Nov 8, 2002
              • 0 Attachment
                Josiah,

                > GUIboxContainer needs boundaries that do not allow things inside
                > GUIboxContainer to display outside.

                You may want to look into using an svg element since it creates an implied
                clipping path. You GUIBox might look like this:

                <svg x="{$x}" y="{$y}" width="{$width}" height="{$height}">
                <rect width="100%" height="100%" style="{$style}"/>
                </svg>

                However, the svg element is not transformable, so you won't be able to apply
                rotation, skew, etc, but chances are that isn't important.

                Kevin,
                KevLinDev - http://www.kevlindev.com
              • Tobias Reif
                ... I like how well XML can be mapped to OO: elements classes(objects) attributes instance vars / getters/setters
                Message 7 of 7 , Nov 8, 2002
                • 0 Attachment
                  josiahjohnston wrote:


                  > I'm getting the impression SVG does not lend itself well to OOP. At
                  > least not in a way I'm accustomed to.


                  I like how well XML can be mapped to OO:

                  elements <=> classes(objects)
                  attributes <=> instance vars / getters/setters

                  http://www.pinkjuice.com/ruby/jelly/ :

                  [...]
                  class Animate < Element

                  include Utils
                  include StdAttrs
                  include TestAttrs
                  include AnimationEvents
                  include AnimTargetAttrs
                  include AnimTimingAttrs
                  include AnimValueAttrs
                  include AnimAdditionAttrs

                  # Animate.new => <animate/>
                  def initialize
                  super('animate')
                  end

                  # example:
                  # a = Animate.new
                  # a.externalResourcesRequired=val
                  # print a
                  # # => <animate externalResourcesRequired='val'/>

                  def externalResourcesRequired= value
                  value = value.to_s
                  @attributes['externalResourcesRequired'] = value
                  value.to_number
                  end

                  def externalResourcesRequired
                  @attributes['externalResourcesRequired'].to_s.to_number
                  end

                  end
                  [...]


                  Tobi

                  --
                  http://www.pinkjuice.com/
                Your message has been successfully submitted and would be delivered to recipients shortly.