Ai2Canvas icon indicating copy to clipboard operation
Ai2Canvas copied to clipboard

features request

Open neekey opened this issue 11 years ago • 0 comments

Hi, Thank you for creating such a helpful plugin for AI, which makes drawing complex vector graph in canvas possible.

As using this current version 1.3 in my project ( a map of China with provinces, landmarks, textures, clouds, waters, ships.. and so on, the total size of export is almost 6M ), I found the ability to only export root level layers is not efficient both in code development and AI design.

And, the more complicated the AI layers are, the more details need to be taken care of when considering the performance with canvas especially with mobile devices, all the layers should be drew only if necessary.

So below is the features I want to request:

Include boundary info

Boundary info is very helpful, which can be use to calculate if current layer is in the viewport or for other intentions.

I think every layer should include boundary info like below:

{
    left: 10,
    top: 10,
    width: 10,
    height: 20
}

Exports pure javascript data

It will be convenient if pure Javascript can be exported, and wrapped with CMD module, or just write to the global:

- map();

exports:

window.ai2canvas.map = {
    boundary: {
        left: 10,
        top: 10,
        width: 10,
        height: 20    
    },
    draw: function( ctx ){ ..... }
}

Support sublayers export

layers like:

- map
    - beijing
    - shanghai
    - ....

and exports:

window.ai2canvas.map = {
    name: 'map'
    boundary: {
        left: 10,
        top: 10,
        width: 10,
        height: 20    
    },
    draw: function( ctx ){ ..... },
    children: [
        {
            name: 'beigjing',
            draw: function( ctx ){ ... },
            ....
        }
    ] // every child just like its father, have properties like `boundary`, `draw` and `children` if sublayers exist
}

Thank you~

neekey avatar Dec 16 '14 04:12 neekey