commit
9b4b3ad9bc
|
@ -0,0 +1,3 @@
|
|||
TAGS
|
||||
*~
|
||||
_*
|
|
@ -18,15 +18,16 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
Str = String,
|
||||
$ = Snap._.$;
|
||||
Snap.filter = {};
|
||||
// SIERRA Paper.filter(): I don't understand the note. Does that mean an HTML should dedicate a separate SVG region for a filter definition? What's the advantage over a DEFS?
|
||||
/*\
|
||||
* Paper.filter
|
||||
[ method ]
|
||||
**
|
||||
* Creates filter element
|
||||
* Creates a `<filter>` element
|
||||
**
|
||||
- filstr (string) SVG fragment of filter provided as a string.
|
||||
- filstr (string) SVG fragment of filter provided as a string
|
||||
= (object) @Element
|
||||
* Note: It is recommended to use filters embedded into page inside empty SVG element.
|
||||
* Note: It is recommended to use filters embedded into the page inside an empty SVG element.
|
||||
> Usage
|
||||
| var f = paper.filter('<feGaussianBlur stdDeviation="2"/>'),
|
||||
| c = paper.circle(10, 10, 10).attr({
|
||||
|
@ -81,15 +82,16 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
this.node.removeAttribute("filter");
|
||||
}
|
||||
});
|
||||
|
||||
// SIERRA Would help to clarify when various Snap.filter.* matches the behavior of CSS filter property keyword functions. E.g., I don't think CSS's blur() accepts a second parameter for y axis.
|
||||
// SIERRA Would also be useful to illustrate a chain of >1 filter as a code snippet.
|
||||
/*\
|
||||
* Snap.filter.blur
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the blur filter.
|
||||
* Returns an SVG markup string for the blur filter
|
||||
**
|
||||
- x (number) amount of horisontal blur in px.
|
||||
- y (number) #optional amount of vertical blur in px.
|
||||
- x (number) amount of horizontal blur, in pixels
|
||||
- y (number) #optional amount of vertical blur, in pixels
|
||||
= (string) filter representation
|
||||
> Usage
|
||||
| var f = paper.filter(Snap.filter.blur(5, 10)),
|
||||
|
@ -113,12 +115,12 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.shadow
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the shadow filter.
|
||||
* Returns an SVG markup string for the shadow filter
|
||||
**
|
||||
- dx (number) horisontal shift of the shadow in px.
|
||||
- dy (number) vertical shift of the shadow in px.
|
||||
- blur (number) #optional amount of blur.
|
||||
- color (string) #optional color of the shadow.
|
||||
- dx (number) horizontal shift of the shadow, in pixels
|
||||
- dy (number) vertical shift of the shadow, in pixels
|
||||
- blur (number) #optional amount of blur
|
||||
- color (string) #optional color of the shadow
|
||||
= (string) filter representation
|
||||
> Usage
|
||||
| var f = paper.filter(Snap.filter.shadow(0, 2, 3)),
|
||||
|
@ -157,9 +159,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.grayscale
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the grayscale filter.
|
||||
* Returns an SVG markup string for the grayscale filter
|
||||
**
|
||||
- amount (number) amount of filter (`0..1`).
|
||||
- amount (number) amount of filter (`0..1`)
|
||||
= (string) filter representation
|
||||
\*/
|
||||
Snap.filter.grayscale = function (amount) {
|
||||
|
@ -184,9 +186,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.sepia
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the sepia filter.
|
||||
* Returns an SVG markup string for the sepia filter
|
||||
**
|
||||
- amount (number) amount of filter (`0..1`).
|
||||
- amount (number) amount of filter (`0..1`)
|
||||
= (string) filter representation
|
||||
\*/
|
||||
Snap.filter.sepia = function (amount) {
|
||||
|
@ -212,9 +214,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.saturate
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the saturate filter.
|
||||
* Returns an SVG markup string for the saturate filter
|
||||
**
|
||||
- amount (number) amount of filter (`0..1`).
|
||||
- amount (number) amount of filter (`0..1`)
|
||||
= (string) filter representation
|
||||
\*/
|
||||
Snap.filter.saturate = function (amount) {
|
||||
|
@ -232,9 +234,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.hueRotate
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the hue-rotate filter.
|
||||
* Returns an SVG markup string for the hue-rotate filter
|
||||
**
|
||||
- angle (number) angle of rotation.
|
||||
- angle (number) angle of rotation
|
||||
= (string) filter representation
|
||||
\*/
|
||||
Snap.filter.hueRotate = function (angle) {
|
||||
|
@ -250,9 +252,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.invert
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the invert filter.
|
||||
* Returns an SVG markup string for the invert filter
|
||||
**
|
||||
- amount (number) amount of filter (`0..1`).
|
||||
- amount (number) amount of filter (`0..1`)
|
||||
= (string) filter representation
|
||||
\*/
|
||||
Snap.filter.invert = function (amount) {
|
||||
|
@ -271,9 +273,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.brightness
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the brightness filter.
|
||||
* Returns an SVG markup string for the brightness filter
|
||||
**
|
||||
- amount (number) amount of filter (`0..1`).
|
||||
- amount (number) amount of filter (`0..1`)
|
||||
= (string) filter representation
|
||||
\*/
|
||||
Snap.filter.brightness = function (amount) {
|
||||
|
@ -291,9 +293,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.filter.contrast
|
||||
[ method ]
|
||||
**
|
||||
* Returns string of the contrast filter.
|
||||
* Returns an SVG markup string for the contrast filter
|
||||
**
|
||||
- amount (number) amount of filter (`0..1`).
|
||||
- amount (number) amount of filter (`0..1`)
|
||||
= (string) filter representation
|
||||
\*/
|
||||
Snap.filter.contrast = function (amount) {
|
||||
|
|
47
src/mina.js
47
src/mina.js
|
@ -122,30 +122,31 @@ var mina = (function (eve) {
|
|||
}
|
||||
len && requestAnimFrame(frame);
|
||||
},
|
||||
// SIERRA Unfamiliar with the word _slave_ in this context. Also, I don't know what _gereal_ means. Do you mean _general_?
|
||||
/*\
|
||||
* mina
|
||||
[ method ]
|
||||
**
|
||||
* Generic animation of numbers.
|
||||
* Generic animation of numbers
|
||||
**
|
||||
- a (number) start “slave” number
|
||||
- A (number) end “slave” number
|
||||
- b (number) start “master” number (start time in gereal case)
|
||||
- B (number) end “master” number (end time in gereal case)
|
||||
- get (function) getter of “master” number (see @mina.time)
|
||||
- set (function) setter of “slave” number
|
||||
- a (number) start _slave_ number
|
||||
- A (number) end _slave_ number
|
||||
- b (number) start _master_ number (start time in gereal case)
|
||||
- B (number) end _master_ number (end time in gereal case)
|
||||
- get (function) getter of _master_ number (see @mina.time)
|
||||
- set (function) setter of _slave_ number
|
||||
- easing (function) #optional easing function, default is @mina.linear
|
||||
= (object) animation descriptor
|
||||
o {
|
||||
o id (string) animation id,
|
||||
o start (number) start “slave” number,
|
||||
o end (number) end “slave” number,
|
||||
o b (number) start “master” number,
|
||||
o start (number) start _slave_ number,
|
||||
o end (number) end _slave_ number,
|
||||
o b (number) start _master_ number,
|
||||
o s (number) animation status (0..1),
|
||||
o dur (number) animation duration,
|
||||
o spd (number) animation speed,
|
||||
o get (function) getter of “master” number (see @mina.time),
|
||||
o set (function) setter of “slave” number,
|
||||
o get (function) getter of _master_ number (see @mina.time),
|
||||
o set (function) setter of _slave_ number,
|
||||
o easing (function) easing function, default is @mina.linear,
|
||||
o status (function) status getter/setter,
|
||||
o speed (function) speed getter/setter,
|
||||
|
@ -187,7 +188,7 @@ var mina = (function (eve) {
|
|||
* mina.time
|
||||
[ method ]
|
||||
**
|
||||
* Returns current time. Equal to
|
||||
* Returns the current time. Equivalent to:
|
||||
| function () {
|
||||
| return (new Date).getTime();
|
||||
| }
|
||||
|
@ -197,8 +198,8 @@ var mina = (function (eve) {
|
|||
* mina.getById
|
||||
[ method ]
|
||||
**
|
||||
* Returns animation by it’s id.
|
||||
- id (string) animation’s id
|
||||
* Returns an animation by its id
|
||||
- id (string) animation's id
|
||||
= (object) See @mina
|
||||
\*/
|
||||
mina.getById = function (id) {
|
||||
|
@ -209,7 +210,7 @@ var mina = (function (eve) {
|
|||
* mina.linear
|
||||
[ method ]
|
||||
**
|
||||
* Default linear easing.
|
||||
* Default linear easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
@ -220,7 +221,7 @@ var mina = (function (eve) {
|
|||
* mina.easeout
|
||||
[ method ]
|
||||
**
|
||||
* Easeout easing.
|
||||
* Easeout easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
@ -231,7 +232,7 @@ var mina = (function (eve) {
|
|||
* mina.easein
|
||||
[ method ]
|
||||
**
|
||||
* Easein easing.
|
||||
* Easein easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
@ -242,7 +243,7 @@ var mina = (function (eve) {
|
|||
* mina.easeinout
|
||||
[ method ]
|
||||
**
|
||||
* Easeinout easing.
|
||||
* Easeinout easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
@ -266,7 +267,7 @@ var mina = (function (eve) {
|
|||
* mina.backin
|
||||
[ method ]
|
||||
**
|
||||
* Backin easing.
|
||||
* Backin easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
@ -281,7 +282,7 @@ var mina = (function (eve) {
|
|||
* mina.backout
|
||||
[ method ]
|
||||
**
|
||||
* Backout easing.
|
||||
* Backout easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
@ -297,7 +298,7 @@ var mina = (function (eve) {
|
|||
* mina.elastic
|
||||
[ method ]
|
||||
**
|
||||
* Elastic easing.
|
||||
* Elastic easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
@ -312,7 +313,7 @@ var mina = (function (eve) {
|
|||
* mina.bounce
|
||||
[ method ]
|
||||
**
|
||||
* Bounce easing.
|
||||
* Bounce easing
|
||||
- n (number) input 0..1
|
||||
= (number) output 0..1
|
||||
\*/
|
||||
|
|
71
src/mouse.js
71
src/mouse.js
|
@ -148,7 +148,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.click
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for click for the element.
|
||||
* Adds a click event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -156,7 +156,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.unclick
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for click for the element.
|
||||
* Removes a click event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -165,7 +165,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.dblclick
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for double click for the element.
|
||||
* Adds a double click event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -173,7 +173,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.undblclick
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for double click for the element.
|
||||
* Removes a double click event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -182,7 +182,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.mousedown
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for mousedown for the element.
|
||||
* Adds a mousedown event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -190,7 +190,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.unmousedown
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for mousedown for the element.
|
||||
* Removes a mousedown event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -199,7 +199,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.mousemove
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for mousemove for the element.
|
||||
* Adds a mousemove event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -207,7 +207,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.unmousemove
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for mousemove for the element.
|
||||
* Removes a mousemove event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -216,7 +216,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.mouseout
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for mouseout for the element.
|
||||
* Adds a mouseout event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -224,7 +224,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.unmouseout
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for mouseout for the element.
|
||||
* Removes a mouseout event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -233,7 +233,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.mouseover
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for mouseover for the element.
|
||||
* Adds a mouseover event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -241,7 +241,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.unmouseover
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for mouseover for the element.
|
||||
* Removes a mouseover event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -250,7 +250,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.mouseup
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for mouseup for the element.
|
||||
* Adds a mouseup event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -258,7 +258,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.unmouseup
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for mouseup for the element.
|
||||
* Removes a mouseup event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -267,7 +267,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.touchstart
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for touchstart for the element.
|
||||
* Adds a touchstart event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -275,7 +275,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.untouchstart
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for touchstart for the element.
|
||||
* Removes a touchstart event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -284,7 +284,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.touchmove
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for touchmove for the element.
|
||||
* Adds a touchmove event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -292,7 +292,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.untouchmove
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for touchmove for the element.
|
||||
* Removes a touchmove event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -301,7 +301,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.touchend
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for touchend for the element.
|
||||
* Adds a touchend event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -309,7 +309,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.untouchend
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for touchend for the element.
|
||||
* Removes a touchend event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -318,7 +318,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.touchcancel
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handler for touchcancel for the element.
|
||||
* Adds a touchcancel event handler to the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -326,7 +326,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.untouchcancel
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handler for touchcancel for the element.
|
||||
* Removes a touchcancel event handler from the element
|
||||
- handler (function) handler for the event
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -362,7 +362,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.hover
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handlers for hover for the element.
|
||||
* Adds hover event handlers to the element
|
||||
- f_in (function) handler for hover in
|
||||
- f_out (function) handler for hover out
|
||||
- icontext (object) #optional context for hover in handler
|
||||
|
@ -376,7 +376,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.unhover
|
||||
[ method ]
|
||||
**
|
||||
* Removes event handlers for hover for the element.
|
||||
* Removes hover event handlers from the element
|
||||
- f_in (function) handler for hover in
|
||||
- f_out (function) handler for hover out
|
||||
= (object) @Element
|
||||
|
@ -385,32 +385,37 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
return this.unmouseover(f_in).unmouseout(f_out);
|
||||
};
|
||||
var draggable = [];
|
||||
// SIERRA unclear what _context_ refers to for starting, ending, moving the drag gesture.
|
||||
// SIERRA Element.drag(): _x position of the mouse_: Where are the x/y values offset from?
|
||||
// SIERRA Element.drag(): much of this member's doc appears to be duplicated for some reason.
|
||||
// SIERRA Unclear about this sentence: _Additionally following drag events will be triggered: drag.start.<id> on start, drag.end.<id> on end and drag.move.<id> on every move._ Is there a global _drag_ object to which you can assign handlers keyed by an element's ID?
|
||||
/*\
|
||||
* Element.drag
|
||||
[ method ]
|
||||
**
|
||||
* Adds event handlers for drag of the element.
|
||||
* Adds event handlers for an element's drag gesture
|
||||
**
|
||||
- onmove (function) handler for moving
|
||||
- onstart (function) handler for drag start
|
||||
- onend (function) handler for drag end
|
||||
- mcontext (object) #optional context for moving handler
|
||||
- scontext (object) #optional context for drag start handler
|
||||
- econtext (object) #optional context for drag end handler
|
||||
* Additionaly following `drag` events will be triggered: `drag.start.<id>` on start,
|
||||
* `drag.end.<id>` on end and `drag.move.<id>` on every move. When element will be dragged over another element
|
||||
* `drag.over.<id>` will be fired as well.
|
||||
* Additionaly following `drag` events are triggered: `drag.start.<id>` on start,
|
||||
* `drag.end.<id>` on end and `drag.move.<id>` on every move. When element is dragged over another element
|
||||
* `drag.over.<id>` fires as well.
|
||||
*
|
||||
* Start event and start handler will be called in specified context or in context of the element with following parameters:
|
||||
* Start event and start handler are called in specified context or in context of the element with following parameters:
|
||||
o x (number) x position of the mouse
|
||||
o y (number) y position of the mouse
|
||||
o event (object) DOM event object
|
||||
* Move event and move handler will be called in specified context or in context of the element with following parameters:
|
||||
* Move event and move handler are called in specified context or in context of the element with following parameters:
|
||||
o dx (number) shift by x from the start point
|
||||
o dy (number) shift by y from the start point
|
||||
o x (number) x position of the mouse
|
||||
o y (number) y position of the mouse
|
||||
o event (object) DOM event object
|
||||
* End event and end handler will be called in specified context or in context of the element with following parameters:
|
||||
* End event and end handler are called in specified context or in context of the element with following parameters:
|
||||
o event (object) DOM event object
|
||||
= (object) @Element
|
||||
\*/
|
||||
|
@ -448,7 +453,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.onDragOver
|
||||
[ method ]
|
||||
**
|
||||
* Shortcut for assigning event handler for `drag.over.<id>` event, where id is id of the element (see @Element.id).
|
||||
* Shortcut to assign event handler for `drag.over.<id>` event, where `id` is the element's `id` (see @Element.id)
|
||||
- f (function) handler for event, first argument would be the element you are dragging over
|
||||
\*/
|
||||
// elproto.onDragOver = function (f) {
|
||||
|
@ -458,7 +463,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.undrag
|
||||
[ method ]
|
||||
**
|
||||
* Removes all drag event handlers from given element.
|
||||
* Removes all drag event handlers from the given element
|
||||
\*/
|
||||
elproto.undrag = function () {
|
||||
var i = draggable.length;
|
||||
|
|
123
src/path.js
123
src/path.js
|
@ -1052,26 +1052,26 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.path.getTotalLength
|
||||
[ method ]
|
||||
**
|
||||
* Returns length of the given path in pixels.
|
||||
* Returns the length of the given path in pixels
|
||||
**
|
||||
- path (string) SVG path string.
|
||||
- path (string) SVG path string
|
||||
**
|
||||
= (number) length.
|
||||
= (number) length
|
||||
\*/
|
||||
Snap.path.getTotalLength = getTotalLength;
|
||||
/*\
|
||||
* Snap.path.getPointAtLength
|
||||
[ method ]
|
||||
**
|
||||
* Return coordinates of the point located at the given length on the given path.
|
||||
* Returns the coordinates of the point located at the given length along the given path
|
||||
**
|
||||
- path (string) SVG path string
|
||||
- length (number)
|
||||
- length (number) length, in pixels, from the start of the path, excluding non-rendering jumps VERIFY
|
||||
**
|
||||
= (object) representation of the point:
|
||||
o {
|
||||
o x: (number) x coordinate
|
||||
o y: (number) y coordinate
|
||||
o x: (number) x coordinate,
|
||||
o y: (number) y coordinate,
|
||||
o alpha: (number) angle of derivative
|
||||
o }
|
||||
\*/
|
||||
|
@ -1080,13 +1080,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Snap.path.getSubpath
|
||||
[ method ]
|
||||
**
|
||||
* Return subpath of a given path from given length to given length.
|
||||
* Returns the subpath of a given path between given start and end lengths
|
||||
**
|
||||
- path (string) SVG path string
|
||||
- from (number) position of the start of the segment
|
||||
- to (number) position of the end of the segment
|
||||
- from (number) length, in pixels, from the start of the path to the start of the segment VERIFY
|
||||
- to (number) length, in pixels, from the start of the path to the end of the segment VERIFY
|
||||
**
|
||||
= (string) pathstring for the segment
|
||||
= (string) path string definition for the segment
|
||||
\*/
|
||||
Snap.path.getSubpath = function (path, from, to) {
|
||||
if (this.getTotalLength(path) - to < 1e-6) {
|
||||
|
@ -1099,42 +1099,44 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Element.getTotalLength
|
||||
[ method ]
|
||||
**
|
||||
* Returns length of the path in pixels. Only works for element of “path” type.
|
||||
= (number) length.
|
||||
* Returns the length of the path in pixels (only works for `path` elements)
|
||||
= (number) length
|
||||
\*/
|
||||
elproto.getTotalLength = function () {
|
||||
if (this.node.getTotalLength) {
|
||||
return this.node.getTotalLength();
|
||||
}
|
||||
};
|
||||
// SIERRA Element.getPointAtLength()/Element.getTotalLength(): If a <path> is broken into different segments, is the jump distance to the new coordinates set by the _M_ or _m_ commands calculated as part of the path's total length?
|
||||
/*\
|
||||
* Element.getPointAtLength
|
||||
[ method ]
|
||||
**
|
||||
* Return coordinates of the point located at the given length on the given path. Only works for element of “path” type.
|
||||
* Returns coordinates of the point located at the given length on the given path (only works for `path` elements)
|
||||
**
|
||||
- length (number)
|
||||
- length (number) length, in pixels, from the start of the path, excluding non-rendering jumps VERIFY
|
||||
**
|
||||
= (object) representation of the point:
|
||||
o {
|
||||
o x: (number) x coordinate
|
||||
o y: (number) y coordinate
|
||||
o x: (number) x coordinate,
|
||||
o y: (number) y coordinate,
|
||||
o alpha: (number) angle of derivative
|
||||
o }
|
||||
\*/
|
||||
elproto.getPointAtLength = function (length) {
|
||||
return getPointAtLength(this.attr("d"), length);
|
||||
};
|
||||
// SIERRA Element.getSubpath(): Similar to the problem for Element.getPointAtLength(). Unclear how this would work for a segmented path. Overall, the concept of _subpath_ and what I'm calling a _segment_ (series of non-_M_ or _Z_ commands) is unclear.
|
||||
/*\
|
||||
* Element.getSubpath
|
||||
[ method ]
|
||||
**
|
||||
* Return subpath of a given element from given length to given length. Only works for element of “path” type.
|
||||
* Returns subpath of a given element from given start and end lengths (only works for `path` elements)
|
||||
**
|
||||
- from (number) position of the start of the segment
|
||||
- to (number) position of the end of the segment
|
||||
- from (number) length, in pixels, from the start of the path to the start of the segment VERIFY
|
||||
- to (number) length, in pixels, from the start of the path to the end of the segment VERIFY
|
||||
**
|
||||
= (string) pathstring for the segment
|
||||
= (string) path string definition for the segment
|
||||
\*/
|
||||
elproto.getSubpath = function (from, to) {
|
||||
return Snap.path.getSubpath(this.attr("d"), from, to);
|
||||
|
@ -1146,7 +1148,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
**
|
||||
* Utility method
|
||||
**
|
||||
* Find dot coordinates on the given cubic bezier curve at the given t.
|
||||
* Finds dot coordinates on the given cubic beziér curve at the given t
|
||||
- p1x (number) x of the first point of the curve
|
||||
- p1y (number) y of the first point of the curve
|
||||
- c1x (number) x of the first anchor of the curve
|
||||
|
@ -1158,24 +1160,24 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
- t (number) position on the curve (0..1)
|
||||
= (object) point information in format:
|
||||
o {
|
||||
o x: (number) x coordinate of the point
|
||||
o y: (number) y coordinate of the point
|
||||
o x: (number) x coordinate of the point,
|
||||
o y: (number) y coordinate of the point,
|
||||
o m: {
|
||||
o x: (number) x coordinate of the left anchor
|
||||
o x: (number) x coordinate of the left anchor,
|
||||
o y: (number) y coordinate of the left anchor
|
||||
o }
|
||||
o },
|
||||
o n: {
|
||||
o x: (number) x coordinate of the right anchor
|
||||
o x: (number) x coordinate of the right anchor,
|
||||
o y: (number) y coordinate of the right anchor
|
||||
o }
|
||||
o },
|
||||
o start: {
|
||||
o x: (number) x coordinate of the start of the curve
|
||||
o x: (number) x coordinate of the start of the curve,
|
||||
o y: (number) y coordinate of the start of the curve
|
||||
o }
|
||||
o },
|
||||
o end: {
|
||||
o x: (number) x coordinate of the end of the curve
|
||||
o x: (number) x coordinate of the end of the curve,
|
||||
o y: (number) y coordinate of the end of the curve
|
||||
o }
|
||||
o },
|
||||
o alpha: (number) angle of the curve derivative at the point
|
||||
o }
|
||||
\*/
|
||||
|
@ -1186,7 +1188,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
**
|
||||
* Utility method
|
||||
**
|
||||
* Return bounding box of a given cubic bezier curve
|
||||
* Returns the bounding box of a given cubic beziér curve
|
||||
- p1x (number) x of the first point of the curve
|
||||
- p1y (number) y of the first point of the curve
|
||||
- c1x (number) x of the first anchor of the curve
|
||||
|
@ -1196,15 +1198,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
- p2x (number) x of the second point of the curve
|
||||
- p2y (number) y of the second point of the curve
|
||||
* or
|
||||
- bez (array) array of six points for bezier curve
|
||||
- bez (array) array of six points for beziér curve
|
||||
= (object) point information in format:
|
||||
o {
|
||||
o min: {
|
||||
o x: (number) x coordinate of the left point
|
||||
o x: (number) x coordinate of the left point,
|
||||
o y: (number) y coordinate of the top point
|
||||
o }
|
||||
o },
|
||||
o max: {
|
||||
o x: (number) x coordinate of the right point
|
||||
o x: (number) x coordinate of the right point,
|
||||
o y: (number) y coordinate of the bottom point
|
||||
o }
|
||||
o }
|
||||
|
@ -1216,11 +1218,11 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
**
|
||||
* Utility method
|
||||
**
|
||||
* Returns `true` if given point is inside bounding box.
|
||||
* Returns `true` if given point is inside bounding box
|
||||
- bbox (string) bounding box
|
||||
- x (string) x coordinate of the point
|
||||
- y (string) y coordinate of the point
|
||||
= (boolean) `true` if point inside
|
||||
= (boolean) `true` if point is inside
|
||||
\*/
|
||||
Snap.path.isPointInsideBBox = isPointInsideBBox;
|
||||
/*\
|
||||
|
@ -1232,7 +1234,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Returns `true` if two bounding boxes intersect
|
||||
- bbox1 (string) first bounding box
|
||||
- bbox2 (string) second bounding box
|
||||
= (boolean) `true` if they intersect
|
||||
= (boolean) `true` if bounding boxes intersect
|
||||
\*/
|
||||
Snap.path.isBBoxIntersect = isBBoxIntersect;
|
||||
/*\
|
||||
|
@ -1247,30 +1249,31 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
= (array) dots of intersection
|
||||
o [
|
||||
o {
|
||||
o x: (number) x coordinate of the point
|
||||
o y: (number) y coordinate of the point
|
||||
o t1: (number) t value for segment of path1
|
||||
o t2: (number) t value for segment of path2
|
||||
o segment1: (number) order number for segment of path1
|
||||
o segment2: (number) order number for segment of path2
|
||||
o bez1: (array) eight coordinates representing beziér curve for the segment of path1
|
||||
o x: (number) x coordinate of the point,
|
||||
o y: (number) y coordinate of the point,
|
||||
o t1: (number) t value for segment of path1,
|
||||
o t2: (number) t value for segment of path2,
|
||||
o segment1: (number) order number for segment of path1,
|
||||
o segment2: (number) order number for segment of path2,
|
||||
o bez1: (array) eight coordinates representing beziér curve for the segment of path1,
|
||||
o bez2: (array) eight coordinates representing beziér curve for the segment of path2
|
||||
o }
|
||||
o ]
|
||||
\*/
|
||||
Snap.path.intersection = pathIntersection;
|
||||
Snap.path.intersectionNumber = pathIntersectionNumber;
|
||||
// SIERRA Does the fill mode affect how isPointInside behaves?
|
||||
/*\
|
||||
* Snap.path.isPointInside
|
||||
[ method ]
|
||||
**
|
||||
* Utility method
|
||||
**
|
||||
* Returns `true` if given point is inside a given closed path.
|
||||
* Returns `true` if given point is inside a given closed path
|
||||
- path (string) path string
|
||||
- x (number) x of the point
|
||||
- y (number) y of the point
|
||||
= (boolean) true, if point is inside the path
|
||||
= (boolean) `true` if point is inside the path
|
||||
\*/
|
||||
Snap.path.isPointInside = isPointInsidePath;
|
||||
/*\
|
||||
|
@ -1279,15 +1282,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
**
|
||||
* Utility method
|
||||
**
|
||||
* Return bounding box of a given path
|
||||
* Returns the bounding box of a given path
|
||||
- path (string) path string
|
||||
= (object) bounding box
|
||||
o {
|
||||
o x: (number) x coordinate of the left top point of the box
|
||||
o y: (number) y coordinate of the left top point of the box
|
||||
o x2: (number) x coordinate of the right bottom point of the box
|
||||
o y2: (number) y coordinate of the right bottom point of the box
|
||||
o width: (number) width of the box
|
||||
o x: (number) x coordinate of the left top point of the box,
|
||||
o y: (number) y coordinate of the left top point of the box,
|
||||
o x2: (number) x coordinate of the right bottom point of the box,
|
||||
o y2: (number) y coordinate of the right bottom point of the box,
|
||||
o width: (number) width of the box,
|
||||
o height: (number) height of the box
|
||||
o }
|
||||
\*/
|
||||
|
@ -1299,7 +1302,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
**
|
||||
* Utility method
|
||||
**
|
||||
* Converts path coordinates into relative values.
|
||||
* Converts path coordinates into relative values
|
||||
- path (string) path string
|
||||
= (array) path string
|
||||
\*/
|
||||
|
@ -1310,7 +1313,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
**
|
||||
* Utility method
|
||||
**
|
||||
* Converts path coordinates into absolute values.
|
||||
* Converts path coordinates into absolute values
|
||||
- path (string) path string
|
||||
= (array) path string
|
||||
\*/
|
||||
|
@ -1321,16 +1324,16 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
**
|
||||
* Utility method
|
||||
**
|
||||
* Converts path to a new path where all segments are cubic bezier curves.
|
||||
* Converts path to a new path where all segments are cubic beziér curves
|
||||
- pathString (string|array) path string or array of segments
|
||||
= (array) array of segments.
|
||||
= (array) array of segments
|
||||
\*/
|
||||
Snap.path.toCubic = path2curve;
|
||||
/*\
|
||||
* Snap.path.map
|
||||
[ method ]
|
||||
**
|
||||
* Transform the path string with given matrix.
|
||||
* Transform the path string with the given matrix
|
||||
- path (string) path string
|
||||
- matrix (object) see @Matrix
|
||||
= (string) transformed path string
|
||||
|
|
14
src/set.js
14
src/set.js
|
@ -34,7 +34,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Set.push
|
||||
[ method ]
|
||||
**
|
||||
* Adds each argument to the current set.
|
||||
* Adds each argument to the current set
|
||||
= (object) original element
|
||||
\*/
|
||||
setproto.push = function () {
|
||||
|
@ -54,7 +54,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Set.pop
|
||||
[ method ]
|
||||
**
|
||||
* Removes last element and returns it.
|
||||
* Removes last element and returns it
|
||||
= (object) element
|
||||
\*/
|
||||
setproto.pop = function () {
|
||||
|
@ -65,9 +65,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Set.forEach
|
||||
[ method ]
|
||||
**
|
||||
* Executes given function for each element in the set.
|
||||
* Executes given function for each element in the set
|
||||
*
|
||||
* If function returns `false` it will stop loop running.
|
||||
* If the function returns `false`, the loop stops running.
|
||||
**
|
||||
- callback (function) function to run
|
||||
- thisArg (object) context object for the callback
|
||||
|
@ -91,7 +91,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Set.clear
|
||||
[ method ]
|
||||
**
|
||||
* Removeds all elements from the set
|
||||
* Removes all elements from the set
|
||||
\*/
|
||||
setproto.clear = function () {
|
||||
while (this.length) {
|
||||
|
@ -102,7 +102,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Set.splice
|
||||
[ method ]
|
||||
**
|
||||
* Removes given element from the set
|
||||
* Removes range of elements from the set
|
||||
**
|
||||
- index (number) position of the deletion
|
||||
- count (number) number of element to remove
|
||||
|
@ -142,7 +142,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
* Removes given element from the set
|
||||
**
|
||||
- element (object) element to remove
|
||||
= (boolean) `true` if object was found & removed from the set
|
||||
= (boolean) `true` if object was found and removed from the set
|
||||
\*/
|
||||
setproto.exclude = function (el) {
|
||||
for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) {
|
||||
|
|
444
src/svg.js
444
src/svg.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue