vdelachaux / SVG-with-Classes

A class to manage SVG creation
MIT License
1 stars 1 forks source link

Line Patterns #8

Open truegold opened 10 months ago

truegold commented 10 months ago

Hi Vincent,

I'm trying to replace (using your SVG Classes):

"SVG_DashArray_Pattern($axisStyle_Mc_Asc; $line_svgRef)"

Is this possible? If so, may I please have an example?

Thanks, John...

truegold commented 10 months ago

Sorry, I have a wrapper method around it. This is the actual SVG command:

Case of : ($pattern="Dot/Tight") SVG_SET_STROKE_DASHARRAY($svg_Ref; 1; 5)

: ($pattern="Dot/Wide")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 1; 10)

: ($pattern="Dash/Small")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 5; 5)

: ($pattern="Dash/Medium")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 10; 5)

: ($pattern="Dash/Large")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 15; 5)

: ($pattern="Dash/Gap1")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 5; 10)

: ($pattern="Dash/Gap2")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 5; 15)

: ($pattern="Combo1")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 15; 10; 5)

: ($pattern="Combo2")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 15; 10; 5; 10)

: ($pattern="Combo3")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 15; 10; 5; 10; 5)

End case

Thanks, John...

vdelachaux commented 10 months ago

Hi John, Happy New Year Just submitted svg.dasharray() function with an HDI. HTH Vincent

truegold commented 10 months ago

Hi Vincent,

Thank you. I will give it a try!

Appreciate, John...

On Jan 3, 2024, at 2:51 AM, Vincent de Lachaux @.***> wrote:

Hi John, Happy New Year Just submitted svg.dasharray() function with an HDI. HTH Vincent

— Reply to this email directly, view it on GitHub https://github.com/vdelachaux/SVG-with-Classes/issues/8#issuecomment-1875176383, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGECHC4SB3VKINWERUJUTF3YMUZ4ZAVCNFSM6AAAAABBF2LP2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGE3TMMZYGM. You are receiving this because you authored the thread.

vdelachaux commented 10 months ago

Hello John, May I close this issue? Vincent

truegold commented 10 months ago

Hi Vincent,

Sorry! I haven’t had time to test yet. I’ll try later today and get back to you.

Appreciate, John…

On Jan 9, 2024, at 1:19 AM, Vincent de Lachaux @.***> wrote:

Hello John, May I close this issue? Vincent

— Reply to this email directly, view it on GitHub https://github.com/vdelachaux/SVG-with-Classes/issues/8#issuecomment-1882683954, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGECHC7PLNOW7BUCSDEXT7LYNUDQRAVCNFSM6AAAAABBF2LP2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSGY4DGOJVGQ. You are receiving this because you authored the thread.

truegold commented 10 months ago

Hi Vincent,

Looks good in both your example and my app.

Well except this error:

colorErr

"A function or property color is unexpected. (550.3)"

How can I resolve?

Appreciate, John...

vdelachaux commented 10 months ago

Is the function declared like this?

Function dasharray($dash : Real;  ...  : Integer) : cs.svg

     …

 return This

Did you recompile your project ?

truegold commented 10 months ago

Hi Vincent,

I was testing "HDI line02" in the example you provided. I was using 4D v20R2 and I discovered that it needs to be in 4D v20R3.

Do you know why it requires v20R3 vs v20R2? Syntax difference?

Thanks, John...

truegold commented 10 months ago

Hi Vincent,

".dasharray(5; 50)" works wonderfully when the parameters are hard coded. What I am attempting to replicate is having the pattern selected based upon a popup like this:

pop

Which I have a method that dispatches based upon the selection. Here's a fragment:

Case of :(...)

    APPEND TO ARRAY($aPatterns; "Combo1")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 15; 10; 5)

    APPEND TO ARRAY($aPatterns; "Combo2")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 15; 10; 5; 10)

    APPEND TO ARRAY($aPatterns; "Combo3")
    SVG_SET_STROKE_DASHARRAY($svg_Ref; 15; 10; 5; 10; 5)

End Case

I need the dashed properties to be stored in an object (I store the selected value like "Combo2") and then use it to redraw the circle or line. I am building reusable templates.

How would you manage the dashed properties using SVG class? I don't think the current incarnation will work. If I could pass ".dasharray($pattern_t)" as text and then the string is parsed in the SVG class it might work. Unless I have a blind spot?

Appreciate, John...

truegold commented 9 months ago

Hi Vincent,

Do you have any thoughts on how to use "dashed-arrays" in a kind of template with name, so they can be displayed in a popup choice list?

Thanks, John...