mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge pull request #24245 from FlashSystems/snapsvg_updates
Refined some declarations for snapsvg
This commit is contained in:
commit
210280fd69
11
types/snapsvg/index.d.ts
vendored
11
types/snapsvg/index.d.ts
vendored
@ -136,16 +136,19 @@ declare namespace Snap {
|
||||
|
||||
export interface Element {
|
||||
add(el:Snap.Element):Snap.Element;
|
||||
add(el:Snap.Set):Snap.Element;
|
||||
addClass(value:string):Snap.Element;
|
||||
after(el:Snap.Element):Snap.Element;
|
||||
align(el: Snap.Element, way: string):Snap.Element;
|
||||
animate(animation:any):Snap.Element;
|
||||
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num: number)=> number,callback?:()=>void):Snap.Element;
|
||||
append(el:Snap.Element):Snap.Element;
|
||||
append(el:Snap.Set):Snap.Element;
|
||||
appendTo(el:Snap.Element):Snap.Element;
|
||||
asPX(attr:string,value?:string):number; //TODO: check what is really returned
|
||||
attr(param:string):string;
|
||||
attr(params:{[attr:string]:string|number|boolean|any}):Snap.Element;
|
||||
attr(param: "viewBox"): BBox;
|
||||
attr(param: string): string;
|
||||
attr(params:{[attr:string]:string|number|boolean|BBox|any}):Snap.Element;
|
||||
before(el:Snap.Element):Snap.Element;
|
||||
children(): Snap.Element[];
|
||||
clone():Snap.Element;
|
||||
@ -284,12 +287,14 @@ declare namespace Snap {
|
||||
rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element;
|
||||
text(x:number,y:number,text:string|number):Snap.Element;
|
||||
text(x:number,y:number,text:Array<string|number>):Snap.Element;
|
||||
symbol(vbx:number,vby:number,vbw:number,vbh:number):Snap.Element;
|
||||
}
|
||||
|
||||
export interface Set {
|
||||
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num:number)=>number,callback?:()=>void):Snap.Element;
|
||||
animate(...params:Array<{attrs:any,duration:number,easing:(num:number)=>number,callback?:()=>void}>):Snap.Element;
|
||||
attr(params: {[attr:string]:string|number|boolean|any}): Snap.Element;
|
||||
attr(params: {[attr:string]:string|number|boolean|BBox|any}): Snap.Element;
|
||||
attr(param: "viewBox"): BBox;
|
||||
attr(param: string): string;
|
||||
bind(attr: string, callback: Function): Snap.Set;
|
||||
bind(attr:string,element:Snap.Element):Snap.Set;
|
||||
|
||||
@ -125,6 +125,19 @@ function tester6() {
|
||||
console.log(!path.isPointInsideBBox(b3, 50, 50));
|
||||
}
|
||||
|
||||
function tester7() {
|
||||
var paper = Snap(600, 800);
|
||||
|
||||
Snap.load("http://snapsvg.io/assets/images/logo.svg", (fragment: Snap.Fragment) => {
|
||||
// viewBox retrieveal
|
||||
let fragmentViewBox = fragment.select("svg").attr("viewBox");
|
||||
let symbol = paper.symbol(fragmentViewBox.x, fragmentViewBox.y, fragmentViewBox.width, fragmentViewBox.height);
|
||||
|
||||
symbol.add(fragment.selectAll("svg *"));
|
||||
symbol.toDefs();
|
||||
});
|
||||
}
|
||||
|
||||
//$(function () {
|
||||
// tester1();
|
||||
//});
|
||||
@ -134,3 +147,4 @@ function tester6() {
|
||||
//tester4();
|
||||
//tester5();
|
||||
//tester6();
|
||||
//tester7();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user