raphael

Raphaël Object: Simulate click

早过忘川 提交于 2019-12-02 11:45:35
问题 It it possible to simulate an click on an Raphaël object? I tried already object.click(); // Error: click is not a function // or object.dispatchEvent('click'); // Error: Could not convert JavaScript argument arg 0 [nsIDOMEventTarget.dispatchEvent] 回答1: Just access the DOM node using Element.node as described in the docs. You can then trigger events on the node as you would with any other DOM element http://jsfiddle.net/UFZXP/ http://lifescaler.com/2008/04/simulating-mouse-clicks-in

Raphael path resize and move relative to container

廉价感情. 提交于 2019-12-02 09:19:32
问题 I am trying to scale/move an SVG path created with the Raphael api. I want the path to fit neatly within a container, no matter the size of the container. I have searched the reference, the web and I'm still struggling to get this to work. If anyone can tell me why this isn't working, I would be very happy. This fiddle shows you what I'm doing: http://jsfiddle.net/tolund/3XPxL/5/ JavaScript: var draw = function(size) { var $container = $("#container").empty(); $container.css("height",size+"px

How to avoid overlapping of Rapahel js path

北战南征 提交于 2019-12-02 07:39:55
I have a flow chart which is based on Raphael js. it is same as that of http://raphaeljs.com/graffle.html . however since i have many rectangular Raphael boxes and my line path is of straight line and NOT curvy as shown in the above example. In this straight line type, these lines overlap sometime and so it is hard to tell which one is connecting which boxes. Please let me know if i can achieve this and how. Update :Attaching my current flow diagram jpeg. as you can see that connector lines are crossing over the Raphael shapes and also it is very hard to tell from where lines are starting. 来源:

Raphael dropshadow plugin firefox and opera issue on a svg path

只谈情不闲聊 提交于 2019-12-02 03:37:44
问题 I'm having a strange issue while experimenting the dropshadow.raphael.js plugin based on raphael blur plugin (I tried with the css filter plugin, same issue). I am drawing a Bezier path and adding the dropshadow : var borderBottomRounded = paper.path("M150,100C20,200,600,200,400,100"); borderBottomRounded.attr({'stroke':'#000000', 'stroke-width':'1'}); borderBottomRounded.dropShadow(1,0,1,0.5); // dropShadow(size, offsetX, offsetY, opacity = 1) There, the shadow is working fine on every

jQuery - Raphael - SVG - selector based on custom data

主宰稳场 提交于 2019-12-02 00:07:59
I have assigned a custom data attribute to some circles added to the Raphael canvas as follows in a each() loop: marker.data('transaction', transaction); How do I find elements on the canvas that have the same transaction data value? Currently I have the code: var found = document.querySelectorAll("[transaction='" + current_transaction +"']"); Which should return a NodeList with the elements, but it doesn't work. To retrieve the data into a variable, it is as simple as var foo = marker.data('transaction') , but obviously, this doesn't work if I want to retrieve a NodeList of the elements.

jQuery - Raphael - SVG - selector based on custom data

夙愿已清 提交于 2019-12-02 00:03:47
问题 I have assigned a custom data attribute to some circles added to the Raphael canvas as follows in a each() loop: marker.data('transaction', transaction); How do I find elements on the canvas that have the same transaction data value? Currently I have the code: var found = document.querySelectorAll("[transaction='" + current_transaction +"']"); Which should return a NodeList with the elements, but it doesn't work. To retrieve the data into a variable, it is as simple as var foo = marker.data(

Raphael.path2curve does not honor the original path

拟墨画扇 提交于 2019-12-01 23:47:30
I have a problem with Raphael.path2curve() . The function modifies SVG path string so that all path commands are converted to absolute Cubic curves (C). The function supports all path commands ( mlcqahvstMLCQAHVST , see SVG SPEC ). The Raphael.path2curve() can handle well paths in many cases, eg. It can even convert arcs to cubics correct, which is not an easy calculation. I have made many tests and realized that paths that consist of commands QT , CS or HT converts well. There are no problems with also the following: MS, HS, VS, LS, TC, TH, TL, TV, QA, TA . But it cannot handle commands QS,

Inline SVG not working as background-image in IE

妖精的绣舞 提交于 2019-12-01 22:00:42
I'm trying to set the background-image css property to encoded data URI content as shown in this fiddle It works as expected for all browsers I tested. The only browser that doesn't show the contents is IE 9/10. But I have another example that works in IE 9/10. The difference here is that the data URI contents are initially created in Chrome (by Raphaël) and then used in the example. If the SVG is created in IE (as in the 1st fiddle by Raphaël) itself it's not being displayed if used as background-image data. Where is the issue in IE? Is it related to my code or maybe something goes wrong in

Delegating drag function in Raphael

笑着哭i 提交于 2019-12-01 13:52:48
Using Raphael, I wish to be able to drag a shape (an ellipse in the example below) containing a text object, dragging either the shape or the text. I hoped to do this by setting the functions passed to the text element's drag() method to delegate to the associated shape (trying a more polymorphic approach to this other one ). However, this results in an error " obj.addEventListener is not a function " when text.drag(...) is called. I'm new to javascript, so I've probably made a really obvious blunder, but I can't spot it. Have I misused call() in my delegating functions moveText , dragText ,

Raphael- Detect overlapped elements when drag and drop

五迷三道 提交于 2019-12-01 13:06:46
I'm trying to get element by drag and drop another element. I have for example 2 circles: c1 and c2. What i want to do is : if i drop c2 above c1 hence they are overlapped(not entirely necessary), i can get circle c1 (ex:id, title... etc). http://jsfiddle.net/Tomen/LYjnV/1/ Is there a way to do it? user568458 I'm not sure if you want the moving element that collides, or the static one that is collided with - so I'll give both. (it sounds like you want the static one, but it is this one which Element.onDragOver gives, as suggested in Oli's comment) Here is a rudimentary jsfiddle which accesses