Here's a bit of code to handle the feather set when converted by icomoon.io
(which could have multiple path statements):

on dragEnter
  local tFile, tSVG, tIndex, tLine
  set the dragAction to "copy"
  put line 1 of the dragdata["files"] into me
  put url ("file:" & me) into tFile
  set linedel to "<path d="
  set itemdel to quote
  put 0 into tIndex
  repeat for each line tLine in tFile
    add 1 to tIndex
    if tIndex is 1 then next repeat
    put item 2 of tLine after tSVG
  end repeat
  set the iconPath of widget 1 to tSVG
end dragEnter

The feather set worked fine after adding the loop.  (Some, like the
calendar, were already a single path though).  As long as they are just a
sequence of path elements, I'm guessing this should work.

If you want to see the actual SVG, just add another field and "put tFile
into field 2"

On Tue, Jan 2, 2018 at 8:19 PM, hh via use-livecode <
use-livecode@lists.runrev.com> wrote:

> These SVGs are fine.
>
> 1. download the zip from github
> https://codeload.github.com/leungwensen/svg-icon/zip/master
> (29.7 MByte, unpacks to 61.4 MByte)
>
> 2. open one of the folders in dist/svg, e.g. dist/svg/flat
> 3. make a stack with one field and one svg widget:
>
> Script the field as follows
>
> on dragenter
>   set the dragaction to "copy"
>   put line 1 of the dragdata["files"] into me
>   put url("file:"& me) into s
>   set linedel to "<path d="
>   set itemdel to quote
>   put item 2 of line 2 of s into p
>   set the iconPath of widget 1 to p
> end dragenter
>
> 4. drag one of the file icons from the finder to the field.
>
> Works here, for all tested icons, using LC 8 and LC 9.
>
> @JLG: Wrote by a German, also for Americans.
> @BM: Thanks for the link to that wonderful repository.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to