raphael

Gradient transparency of object in RaphaelJS

一曲冷凌霜 提交于 2019-12-11 05:42:46
问题 I'm trying to get a rectangle partly transparent where the left part is opaque while the right part is more transparent if you go into that direction. This works in Firefox, Chrome but not in Internet Explorer 7 or IE8. In IE all rectangles are displayed with the same transparent gradient. function drawTest(y, pct) { var recttest = paper.rect(25,y,100,30); var gradstr = "0.0-#db38cc:5-#db38cc:"+pct; recttest.attr({"fill": gradstr,"opacity": "0.01"}); } $(document).ready(function() { paper =

Sets in raphaeljs not real groups? Transform order

别来无恙 提交于 2019-12-11 03:59:01
问题 I'm having an issue with sets and how transforms are applied. I'm coming from a graphics background, so I'm familiar with scene graphs as well as the normal SVG group syntax, but Raphael is confusing me. Say I have a circle and a set, on which I want to apply a transform. circle = paper.circle(0,0.5) set = paper.set() If I add the circle first, and then transform, it works. set.push circle set.transform("s100,100") To make a 50 radius circle. If I reverse the order, however, set.transform(

Raphael element selection problem

自古美人都是妖i 提交于 2019-12-11 03:03:54
问题 Hopefully this is a simple question for any Raphael experts! I've created a route map where users can click on each country to see the details. It works fine except that passing the mouse over the red line triggers the mouseout event. I need the red line to effectively be just an image on the map and not an interactive element. How do I achieve this? See the map in action: http://www.martyn-roberts.co.uk/cycleafrica/route Thanks! 回答1: You could make an invisible layer over the red line, which

Raphael JS: bring set to front

白昼怎懂夜的黑 提交于 2019-12-11 02:57:32
问题 I was hoping someone could tell me how to bring an entire set of elements toFront in Raphael JS. I am working with some dynamically generated sets of raphael elements, each of which is stored in an array making it easier to interact with and target individual sets. When a user interacts with the various sets I would like to be able to bring the full set to the front of the application. I have tried using .toFront() as outlined here: http://raphaeljs.com/reference.html#Element.toFront However

How to <href..> my svg-logo with Raphael?

五迷三道 提交于 2019-12-11 02:44:26
问题 I'm using a Raphael.js on my site. Take a look logo in the header, please. http://hooche.ru/md2 Code for logo: <script type="text/javascript"> window.onload = function() { var r = Raphael(logo); r.attr({href: "http://google.com/", target: "blank"}); other vector.. ... </script> and html-code for logo^ <div id="logo"></div> But now, we have: 1 letter = 1 Google link = very much Google links and empty, not clickable spaces around letters in one svg-logo. How to do: 1 svg-logo = 1 link to

How do I get URL of upload file into script

风格不统一 提交于 2019-12-11 02:44:23
问题 Upon upload completion, my newly uploaded file has the URL of <div id="uploaded-file"> <img src="http://path-to-my-file.jpg" /> </div> How do I get the URL of that uploaded file into my script? <script> script stuff.use this.etc ('http://path-to-my-file.jpg') }); </script> Thanks in advance for any assistance! EDIT: I used: <script> var myurl = document.getElementById("uploaded-file").getElementsByTagName("img")[0].src; </script> then replace the hardcoded url: Layer_3.mousedown(function() {

How to add context menu on Raphael element?

戏子无情 提交于 2019-12-11 02:09:07
问题 I am working with ExtJS 4 framework and also using Raphael.js in my main application panel. First I was trying to prevent the regular context menu from showing, and I found out very easy solution. raphael_element.node.oncontextmenu = function() { return false; } This is working great, but before returning false I want to add some code to show my own custom menu. Does anyone know how to do that? I have something in html, that was thinking to use in the menu: <ul id="rect_menu" class=

disabling browser context menu on a raphael paper

天大地大妈咪最大 提交于 2019-12-11 02:03:26
问题 I have a Raphael paper defined as R1 = Raphael(0,0, 800, 600); I want to disable context menu on this paper so that I can catch mouse right click event. I don't have it like Raphael("someDiv", 800, 600) to disable the oncontextmenu property for the div. How should I do it in this case? 回答1: obj.node.oncontextmenu = function(){ return false; } http://jsfiddle.net/z6tyH/ 回答2: Try attaching this: /*[Your Element Here]*/.oncontextmenu = function(event){event.preventDefault();} Catching

Raphael opacity not displaying on IE

风格不统一 提交于 2019-12-11 01:48:58
问题 I'm having a problem with the opacity of a div when my site is viewed on Internet Explorer. Using Raphael 2.0 (un-minified) I create a rectangle using the following code: var rIn = Raphael("myDiv", "100%", "100%"); rIn.rect(0, 0, "100%", "100%").attr({fill:"black", stroke:"none", opacity:0.6}); In my CSS files if I have transparent divs using the opacity tag, I also write it include filter which seems to work fine for IE. opacity:0.6; filter: alpha(opacity = 60); However, Raphael does not

Raphael.js convert text to path

我怕爱的太早我们不能终老 提交于 2019-12-11 01:34:18
问题 I've setup a drawing utility with Raphael.js. The user can draw shapes, paths and enter text. Once a user adds text -> Paper.text() to the svg the svg goes into a selectable state. Meaning, if I add text and switch to the pen tool, moving the pen around the svg will cause adjacent dom elements to go into their ::selection state. So I'd like to convert the text to a path to prevent this from happening. I don't see anything like this in the documentation. 回答1: if you use print() instead of text