Skip to content

getIntersection broken on Safari iOS10 iPad (not tested with concrete) #2

Description

@denweng

Just want to inform you.
We had a problem with kineticjs which might be in concrete too.

best regards Tobias & Dennis from SinusQuadrat

getImageData gives back wrong colors in Safari iOS10 iPad. (Tested on an early iPad Air)
Colors values higher than 240 differ 1 from the originaly set value. This breaks the function of hitCanvas and colorIndex / coloKey and getIntersection.

Our solution in kineticjs is to use ios save colors for identifiers:

getRandomColor: function(iosSave) {
    var randColor;
    if(iosSave){
        randColor = (Math.random() * 0xadcea0 << 0).toString(15);
    }else{
        randColor = (Math.random() * 0xFFFFFF << 0).toString(16);
    }
    while (randColor.length < 6) {
        randColor = ZERO + randColor;
    }
    return HASH + randColor;
}

to test independet (canvas in html needed, loggs differing values):

dndcanvas = document.getElementById("dndcanvas");
var ctx = dndcanvas.getContext('2d');
ctx.clearRect(0, 0, dndcanvas.width, dndcanvas.height);

for (var i = 0; i <= 255; i++) {
    ctx.fillStyle = 'rgb(230,230,' + i + ')';
    ctx.fillRect(i, canvasObj.y-35, 1, 1);
    var p = ctx.getImageData(i, canvasObj.y-35, 1, 1).data;
    if (i != p[2]) {
        console.log(p[2]);
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions