Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make a pattern "fixed" in Raphael.js / IE?
    primarykey
    data
    text
    <p>I'm creating a small tool to illustrate the benefits of polarizing lenses. Basically a user will drag the lenses (a Raphael.js path) over a dazzling scene (the CSS background of the container DIV) and "see through" the lenses. Here is the js code:</p> <pre><code>var rsr = Raphael("playmask", 720,540); // Lens path var path_f = rsr.path("M0,73.293c0.024-39.605,17.289-53.697,35.302-61.34C53.315,4.312,99.052-0.012,119.011,0 c38.56,0.021,43.239,11.164,43.229,29.9c-0.002,3.45-0.76,28.632-16.349,58.949c-10.332,20.092-28.434,60.424-76.452,60.396 C29.821,149.223-0.022,112.898,0,73.293 M200.594,29.922c0.011-18.734,4.699-29.871,43.262-29.851 c19.96,0.013,65.691,4.39,83.695,12.052c18.005,7.662,35.254,21.772,35.231,61.379c-0.023,39.606-29.909,75.896-69.526,75.872 c-48.02-0.027-66.076-40.377-76.384-60.484C201.32,58.557,200.594,33.373,200.594,29.922"); path_f.attr({"stroke-width":2, fill:'url(img/polarized.jpg)'} ); var move = function(dx,dy){ this.translate( dx-this.ox, dy-this.oy ); this.ox = dx; this.oy = dy; }, start = function(){ this.ox = 0; this.oy = 0; }, end = function(){ }; path_f.drag(move,start,end); </code></pre> <p>The <code>#playmask</code> div has this CSS (just the "un-polarized" background image and the size):</p> <pre><code>#playmask{ height:540px; width:720px; background: url(img/unpolarized.jpg); } </code></pre> <p>What I'm stuck with is:</p> <ul> <li>Chrome/Firefox, as always, play nice: the lenses shape shows up, and the fill image looks "fixed" while dragging the lenses around (see the first pic);</li> <li>IE versions 7,8,9 work, but (surprise!) they don't behave the same way: the fill image is "glued" to the lens shape (see second attached pic).</li> </ul> <p>What I'm asking here is: can I make IE9/8/7 behave in a similar manner, that is, keeping the fill image fixed while dragging the lenses? If so, how?</p> <p>Firefox screenshot: <img src="https://i.stack.imgur.com/bnBRP.png" alt="behavior in Firefox 11.0"></p> <p>IE9 screenshot: <img src="https://i.stack.imgur.com/pFb1g.jpg" alt="behavior in IE9"></p> <p><strong>Edit</strong> <strike>Using Modernizr to detect browser features, I noticed that this strange behavior seems related to the <strong>"no-smil"</strong> feature of IE.</strike> I found out a bizarre behavior of <strong>IE9</strong>... the background does not "stick", but if I drag the mask around, select some text and press the right mousebutton, it refreshes the "polarized" background to the correct position!!</p> <p><strong>Edit 2 (21 May 2012)</strong> No solution yet :( but to be more precise, it does not relate in any way to the <strong>"no-smil"</strong> feature; and, the correct way to reproduce the bug on IE9 is drag the glass around, select some text in the rest of the page, and roll over the accelerator icon that pops up (the blue one with an arrow in it). The glasses bg magically "refreshes" at the correct position.</p> <p><strong>Important Edit 3 (28 August 2012)</strong></p> <p>You can find it all packed in <a href="http://jsfiddle.net/q4rXm/17/" rel="nofollow noreferrer">this jsfiddle</a> ( <a href="http://jsfiddle.net/q4rXm/17/" rel="nofollow noreferrer">http://jsfiddle.net/q4rXm/17/</a> )</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.
 

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