zextra
Version:
***Zextra*** stands for "Ziko Extra" is an extension package that enhances [ZikoJS](https://github.com/zakarialaoui10/ziko.js) by providing additional utilities and UI elements. It expands ZikoJS with extra features, making it easier to work with custom U
36 lines • 923 B
JavaScript
import ZikoSvgElement from "../ZikoSvgElement.js";
class ZikoSvgImage extends ZikoSvgElement{
constructor(src="",w="100%",h="100%",x=0,y=0){
super()
this.element=document?.createElementNS(
"http://www.w3.org/2000/svg",
"image",
);
this.setSrc(src).width(w).height(h).x(x).y(y);
}
x(x){
this.element.x.baseVal.value=x;
return this;
}
y(y){
this.element.y.baseVal.value=y;
return this;
}
width(w){
this.element?.setAttribute("width",w);
return this;
}
height(h){
this.element?.setAttribute("height",h);
return this;
}
setSrc(src=""){
this.element?.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', src)
return this;
}
}
const svgImage=(src,w,h,x,y)=>new ZikoSvgImage(src,w,h,x,y);
export {
svgImage,
ZikoSvgImage
}