Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more that one picker per document #5

Open
grubshka opened this issue Jun 26, 2012 · 1 comment
Open

Allow more that one picker per document #5

grubshka opened this issue Jun 26, 2012 · 1 comment

Comments

@grubshka
Copy link

Only the first picker of the document is working, probably because of the "id" used for the gradient.
You could handle this by adding a counter in the ColorPicker object, and changing the id and the fill value after the cloneNode.

@grubshka
Copy link
Author

Simple patch :)

192a193,194
>     var pickerCounter = 0;
> 
201a204
>         ++pickerCounter;
210,211c213,223
<             slideElement.appendChild(slide.cloneNode(true));
<             pickerElement.appendChild(picker.cloneNode(true));
---
>             var clonedSlide = slide.cloneNode(true);
>             clonedSlide.firstChild.firstChild.setAttribute("id", "gradient-hsv-" + pickerCounter);
>             clonedSlide.lastChild.setAttribute("fill", "url(#gradient-hsv-" + pickerCounter + ")");
>             slideElement.appendChild(clonedSlide);
> 
>             var clonedPicker = picker.cloneNode(true);
>             clonedPicker.firstChild.firstChild.setAttribute("id", "gradient-black-" + pickerCounter);
>             clonedPicker.firstChild.lastChild.setAttribute("id", "gradient-white-" + pickerCounter);
>             clonedPicker.childNodes[1].setAttribute("fill", "url(#gradient-white-" + pickerCounter + ")");
>             clonedPicker.childNodes[2].setAttribute("fill", "url(#gradient-black-" + pickerCounter + ")");
>             pickerElement.appendChild(clonedPicker);

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

No branches or pull requests

1 participant