rebootcode / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

Color picker breaks on transparent #935

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Pick fill transparent
2. Notice how black is chosen instead, but transparent fill works
3. Can no longer open the picker

What is the expected output? What do you see instead?
- Transparent should be shown instead of black
- Picker should still work

Please use labels and text to provide additional information.
Tried on FF 11 and Chrome 17, Windows. r2069 latest trunk.

As far as I can tell the fault lies with either jGraduate or jPicker. I'm 
leaning towards jGraduate as jPicker demo on their site seems to work fine. It 
works in 2.5.1 so it is most likely due to r2052 jquery update.

Original issue reported on code.google.com by asyazwan on 26 Mar 2012 at 1:28

GoogleCodeExporter commented 8 years ago
The problem is at https://code.google.com/p/svg-edit/source/detail?r=1802 at 
the "Attempt to upgrade the jPicker plug-in to 1.1.5".  Previous versions work 
ok.

Original comment by aldoluis...@gmail.com on 27 Nov 2012 at 6:55

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Just an horrible hack, but a workaround is to add "return hex;" at ValidateHex 
function in jgraduate/jpicker.min.js

          validateHex:
            function(hex)
            {
             return hex;
              hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '');
              if (hex.length > 8) hex = hex.substring(0, 8);
              return hex;
            },

Original comment by aldoluis...@gmail.com on 28 Nov 2012 at 1:44

GoogleCodeExporter commented 8 years ago
Hi,

Interesting. So the jQuery upgrade breaks the latest jPicker. I'll give this a 
closer look when time permits. We'll probably patch it and report the bug to 
the project.

Thanks for poking around!

Original comment by asyazwan on 29 Nov 2012 at 3:10

GoogleCodeExporter commented 8 years ago
It's a little nicer hack:
validateHex:
function(h){
  if(typeof h=="object"){
    h=h.ahex;
  }
  h=h.toLowerCase().replace(/[^a-f0-9]/g,"");
  if(h.length>8){
    h=h.substring(0,8)
  }
  return h
},

Original comment by hajdua...@gmail.com on 1 Dec 2012 at 12:32

GoogleCodeExporter commented 8 years ago
Fixed in r2225

Original comment by duopi...@gmail.com on 5 Dec 2012 at 12:09

GoogleCodeExporter commented 8 years ago
Issue 1002 has been merged into this issue.

Original comment by duopi...@gmail.com on 5 Dec 2012 at 1:23