Note that there are some explanatory texts on larger screens.

plurals
  1. POKineticJS : scaling issue while using custom clipFunc on 2x pixel aspect display
    primarykey
    data
    text
    <p>Kineticjs automatically adopts canvas size and whole graphics on Retina displays, so all looks sharp and clean without blurry pixelation. But thing goes wrong when I try to use custom clipping function.</p> <p>Here is some code</p> <pre><code>this.layerOne = new Kinetic.Layer(); this.layerTwo = new Kinetic.Layer({ clipFunc : function(c){ var ctx = c.getContext(); ctx.rect(0,0,width,height); } }); </code></pre> <p>If I add shape on layerOne it will be rendered perfectly considering 2x pixel aspect, but the same shape added on layerTwo will be rendered ignoring pixel aspect, thus not beign scaled up by 2. As a result shapes on layer with clipFunc becomes 2x smaller.</p> <p><strong>How can I resolve this problem?</strong></p> <p>P.S. Here is some quick <a href="http://jsfiddle.net/X7HwS/4/" rel="nofollow noreferrer">example I've made on JS Fiddle</a></p> <ul> <li>Light Green is background, Dark Green is 100 pixel square, both on non cropped layer;</li> <li>Light Yellow is 100 pixel square, and pink is rectangle with width equals to stage, they are on cropped layer;</li> </ul> <p>On normal screen we see Yellow's width is equal Light Green's width, and properly cropped. Pink is not visible because is being out of clipping region.</p> <p>On Retina display we see Yellow is smaller than Dark Green and Pink is particularly visible. Dark Green and Pink shows us that cropping rectange has normalized dimentions for Retina, but all graphics scaled down.</p> <p>Standart <img src="https://i.stack.imgur.com/A26eh.png" alt="Non-Retina"></p> <p>Pixel Aspect = 2 <img src="https://i.stack.imgur.com/MwzFu.png" alt="Retina"></p> <p><strong>UPDATE</strong>: Same in Chrome on my Galaxy Nexus<br> <strong>UPDATE</strong>: Everything looks perfect in Safari on OS X! Other major browsers (FF, O, Chrome) on OS X are affected.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload