Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

How to add a new button to main buttons list #105

Open
neallea opened this issue Apr 23, 2015 · 1 comment
Open

How to add a new button to main buttons list #105

neallea opened this issue Apr 23, 2015 · 1 comment

Comments

@neallea
Copy link

neallea commented Apr 23, 2015

Hello websanova,
Thanks for the great jQuery plugin.

I've a small issue.
My requirement is that i want to add a new button besides stroke color picker.

This button will add grid to the current canvas. When i click this new button grid will be added to the canvas and when i click again then grid will be removed. Something like toggle the grid. I've completed the grid thing, now I'm stuck with adding button to the “wPaint.menu.main.min.js” file.

I would like to have your guidance so isolate this issue, can you please share pseudo code for it so that i can get idea about how to add button to the main button list?

Thanks in advance.

@abrenoch
Copy link

abrenoch commented Oct 2, 2015

Here is an example that worked for me. Just use this code after including wPaint.

$.extend($.fn.wPaint.menus.main.items, {
    rotateLeft: {
        icon: 'generic',
        img: 'customIcons/custom-icons.png',
        title: 'Rotate Left',
        index: 0,
        callback: function () { 
            // do something here
        }
    },
    rotateRight: {
        icon: 'generic',
        img: 'customIcons/custom-icons.png',
        title: 'Rotate Right',
        index: 1,
        callback: function () { 
            // do something here
        }
    }
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants