elastic-svg
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,89 +0,5 @@ | ||
var elasticSVG = | ||
/******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = function(exports) { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ | ||
/******/ // create a fake namespace object | ||
/******/ // mode & 1: value is a module id, require it | ||
/******/ // mode & 2: merge all properties of value into the ns | ||
/******/ // mode & 4: return value when already ns object | ||
/******/ // mode & 8|1: behave like require | ||
/******/ __webpack_require__.t = function(value, mode) { | ||
/******/ if(mode & 1) value = __webpack_require__(value); | ||
/******/ if(mode & 8) return value; | ||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; | ||
/******/ var ns = Object.create(null); | ||
/******/ __webpack_require__.r(ns); | ||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); | ||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); | ||
/******/ return ns; | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = "./index.js"); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ({ | ||
var elasticSVG;elasticSVG = | ||
/******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ var __webpack_modules__ = ({ | ||
@@ -94,13 +10,20 @@ /***/ "./index.js": | ||
\******************/ | ||
/*! exports provided: default */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return elasticSVG; }); | ||
// v0.0.8 | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "default": () => (/* binding */ elasticSVG) | ||
/* harmony export */ }); | ||
// v0.1.1 | ||
function elasticSVG(selector, opts) { | ||
opts = opts || {}; // containing DOM element, which defaults to body | ||
opts = opts || {}; | ||
var hasWidth = opts.hasOwnProperty("width"); | ||
var hasHeight = opts.hasOwnProperty("height"); | ||
var hasAspect = opts.hasOwnProperty("aspect"); // containing DOM element, which defaults to body | ||
var parent = document.querySelectorAll(selector || "body"); | ||
if (selector instanceof Element) { | ||
var parent = selector; | ||
} else { | ||
var parent = document.querySelectorAll(selector || "body"); | ||
} | ||
@@ -112,22 +35,43 @@ if (!parent || !parent.length) { | ||
parent = parent[0]; // you can specify a width if you like, or we'll snap to size of container | ||
parent = parent[0]; | ||
var initialWidth = parent.clientWidth; // you can specify a width if you like, or we'll snap to size of container | ||
var base = { | ||
width: typeof opts.width !== "undefined" ? opts.width : parent.clientWidth, | ||
width: null, | ||
height: null, | ||
aspect: null, | ||
scale: 1 | ||
}; // we need to remember the original width for scaling purposes | ||
base.original_width = base.width; // you can either specify the height or the aspect ratio. If neither is specified, refaults to roughly the golden ratio | ||
// you can either specify the height and width, which will computed the aspect ration, or one of these and the aspect ratio. | ||
// If neither is specified, defaults to roughly the golden ratio | ||
// specifying the height keeps the svg at a standard height and only resizes the width | ||
// specifying the aspect ratio resizes both | ||
if (typeof opts.height !== "undefined") { | ||
if (hasWidth && hasHeight) { | ||
if (hasAspect) { | ||
console.log("Overriding aspect ratio since both `width` and `height` are specified"); | ||
opts.aspect = opts.height / opts.width; | ||
} | ||
base.width = opts.width; | ||
base.height = opts.height; | ||
base.aspect = base.height / base.width; | ||
} else { | ||
opts.aspect = typeof opts.aspect !== "undefined" ? opts.aspect : 0.618; | ||
base.height = base.width * opts.aspect; | ||
} // create a new SVG element | ||
// if has neither an aspect or BOTH a width and height, default to approximately the golden ratio | ||
opts.aspect = opts.aspect || 0.618; | ||
if (hasWidth && !hasHeight) { | ||
base.width = opts.width; | ||
base.height = base.width * opts.aspect; | ||
} else if (hasHeight) { | ||
base.height = opts.height; | ||
base.width = base.height / opts.aspect; | ||
} else { | ||
// if only has aspect | ||
base.width = initialWidth; | ||
base.height = base.width * opts.aspect; | ||
} | ||
} | ||
base.original_width = base.width; // create a new SVG element | ||
var xmlns = "http://www.w3.org/2000/svg"; | ||
@@ -145,7 +89,9 @@ var svg = document.createElementNS(xmlns, "svg"); | ||
function resize() { | ||
console.log("resizing base"); | ||
var hasWidth = opts.hasOwnProperty("width"); | ||
var hasHeight = opts.hasOwnProperty("height"); | ||
var hasAspect = opts.hasOwnProperty("aspect"); | ||
base.width = parent.clientWidth; | ||
svg.setAttributeNS(null, "width", base.width); // only resize the height if aspect was specified instead of height | ||
svg.setAttributeNS(null, "width", base.width); // if `height` is not specified, resize it to the aspect ratio | ||
if (opts.aspect) { | ||
if (!hasHeight) { | ||
base.height = base.width * opts.aspect; | ||
@@ -155,2 +101,3 @@ svg.setAttributeNS(null, "height", base.height); | ||
base.aspect = base.height / base.width; | ||
base.scale = base.width / base.original_width; // optional callback | ||
@@ -165,4 +112,5 @@ | ||
resize(); | ||
}); | ||
resize(); // call this on load since sometimes the initial conditions are wider than container | ||
}); // manually trigger a page resize and run the resize function once | ||
window.dispatchEvent(new Event('resize')); // resize(); // call this on load since sometimes the initial conditions are wider than container | ||
// methods | ||
@@ -179,3 +127,15 @@ | ||
}; | ||
/* | ||
base.changeWidth = function(width) { | ||
base.width = width; | ||
if (opts.aspect) { | ||
opts.aspect = base.height / base.width; | ||
} else { | ||
opts.width = width; | ||
} | ||
svg.setAttributeNS(null, "width", base.width); | ||
} | ||
*/ | ||
base.changeHeight = function (height) { | ||
@@ -203,3 +163,63 @@ base.height = height; | ||
/******/ })["default"]; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9lbGFzdGljU1ZHL3dlYnBhY2svYm9vdHN0cmFwIiwid2VicGFjazovL2VsYXN0aWNT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BiYXNlLndpZHRoICogb3B0cy5hc3BlY3Q7XG5cdFx0c3ZnLnNldEF0dHJpYnV0ZU5TKG51bGwsIFwiaGVpZ2h0XCIsIGJhc2UuaGVpZ2h0KTtcblx0fVxuXG5cdGJhc2UuY2hhbmdlSGVpZ2h0ID0gZnVuY3Rpb24oaGVpZ2h0KSB7XG4gICAgXHRiYXNlLmhlaWdodCA9IGhlaWdodDtcbiAgICBcdGlmIChvcHRzLmFzcGVjdCkge1xuXHQgICAgXHRvcHRzLmFzcGVjdCA9IGJhc2UuaGVpZ2h0IC8gYmFzZS53aWR0aDtcblx0ICAgIH0gZWxzZSB7XG5cdCAgICBcdG9wdHMuaGVpZ2h0ID0gaGVpZ2h0O1xuXHQgICAgfVxuXHRcdHN2Zy5zZXRBdHRyaWJ1dGVOUyhudWxsLCBcImhlaWdodFwiLCBiYXNlLmhlaWdodCk7XG5cdH1cblxuXHRiYXNlLnRyaWdnZXJSZXNpemUgPSBmdW5jdGlvbigpIHtcblx0XHRyZXNpemUoKTtcblx0fVxuXG5cdGJhc2Uuc3ZnID0gc3ZnO1xuXHRyZXR1cm4gYmFzZTtcbn0iXSwic291cmNlUm9vdCI6IiJ9 | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ if(__webpack_module_cache__[moduleId]) { | ||
/******/ return __webpack_module_cache__[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/make namespace object */ | ||
/******/ (() => { | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = (exports) => { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
/******/ // module exports must be returned from runtime so entry inlining is disabled | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__("./index.js"); | ||
/******/ })() | ||
.default; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9lbGFzdGljU1ZHLy4vaW5kZXguanMiLCJ3ZWJwYWNrOi8vZWxhc3RpY1NWRy93ZWJwYWNrL2Jvb3RzdHJhcCIsIndlYnBhY2s6Ly9lbGFzdGljU1ZHL3dlYnBhY2svcnVudGltZS9kZWZpbmUgcHJvcGVydHkgZ2V0dGVycyIsIndlYnBhY2s6Ly9lbGFzdGljU1ZHL3dlYnBhY2svcnVudGltZS9oYXNPd25Qcm9wZXJ0eSBzaG9ydGhhbmQiLCJ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uXHRcdH1cblx0fVxufTsiLCJfX3dlYnBhY2tfcmVxdWlyZV9fLm8gPSAob2JqLCBwcm9wKSA9PiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iaiwgcHJvcCkpIiwiLy8gZGVmaW5lIF9fZXNNb2R1bGUgb24gZXhwb3J0c1xuX193ZWJwYWNrX3JlcXVpcmVfXy5yID0gKGV4cG9ydHMpID0+IHtcblx0aWYodHlwZW9mIFN5bWJvbCAhPT0gJ3VuZGVmaW5lZCcgJiYgU3ltYm9sLnRvU3RyaW5nVGFnKSB7XG5cdFx0T2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsIFN5bWJvbC50b1N0cmluZ1RhZywgeyB2YWx1ZTogJ01vZHVsZScgfSk7XG5cdH1cblx0T2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogdHJ1ZSB9KTtcbn07IiwiLy8gbW9kdWxlIGV4cG9ydHMgbXVzdCBiZSByZXR1cm5lZCBmcm9tIHJ1bnRpbWUgc28gZW50cnkgaW5saW5pbmcgaXMgZGlzYWJsZWRcbi8vIHN0YXJ0dXBcbi8vIExvYWQgZW50cnkgbW9kdWxlIGFuZCByZXR1cm4gZXhwb3J0c1xucmV0dXJuIF9fd2VicGFja19yZXF1aXJlX18oXCIuL2luZGV4LmpzXCIpO1xuIl0sInNvdXJjZVJvb3QiOiIifQ== |
@@ -1,1 +0,1 @@ | ||
var elasticSVG=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";function n(t,e){e=e||{};var i=document.querySelectorAll(t||"body");if(i&&i.length){i=i[0];var n={width:void 0!==e.width?e.width:i.clientWidth,scale:1};n.original_width=n.width,void 0!==e.height?(n.height=e.height,n.aspect=n.height/n.width):(e.aspect=void 0!==e.aspect?e.aspect:.618,n.height=n.width*e.aspect);var r=document.createElementNS("http://www.w3.org/2000/svg","svg");return r.setAttributeNS(null,"width",n.width),r.setAttributeNS(null,"height",n.height),i.appendChild(r),e.resize&&"auto"==e.resize&&r.setAttributeNS(null,"viewBox","0 0 "+n.width+" "+n.height),window.addEventListener("resize",function(){o()}),o(),n.setResize=function(t){e.onResize=t},n.changeAspect=function(t){e.aspect=t,n.height=n.width*e.aspect,r.setAttributeNS(null,"height",n.height)},n.changeHeight=function(t){n.height=t,e.aspect?e.aspect=n.height/n.width:e.height=t,r.setAttributeNS(null,"height",n.height)},n.triggerResize=function(){o()},n.svg=r,n}function o(){console.log("resizing base"),n.width=i.clientWidth,r.setAttributeNS(null,"width",n.width),e.aspect&&(n.height=n.width*e.aspect,r.setAttributeNS(null,"height",n.height)),n.scale=n.width/n.original_width,e.onResize&&e.onResize(n.width,n.height,n.scale,r)}console.log("Couldn't find a parent for elasticSVG making the selector '"+t+"'")}i.r(e),i.d(e,"default",function(){return n})}]).default; | ||
var elasticSVG;elasticSVG=(()=>{"use strict";var t={89:(t,e,i)=>{function h(t,e){var i=(e=e||{}).hasOwnProperty("width"),h=e.hasOwnProperty("height"),n=e.hasOwnProperty("aspect");if(t instanceof Element)var r=t;else r=document.querySelectorAll(t||"body");if(r&&r.length){var s=(r=r[0]).clientWidth,a={width:null,height:null,aspect:null,scale:1};i&&h?(n&&(console.log("Overriding aspect ratio since both `width` and `height` are specified"),e.aspect=e.height/e.width),a.width=e.width,a.height=e.height):(e.aspect=e.aspect||.618,i&&!h?(a.width=e.width,a.height=a.width*e.aspect):h?(a.height=e.height,a.width=a.height/e.aspect):(a.width=s,a.height=a.width*e.aspect)),a.original_width=a.width;var o=document.createElementNS("http://www.w3.org/2000/svg","svg");return o.setAttributeNS(null,"width",a.width),o.setAttributeNS(null,"height",a.height),r.appendChild(o),e.resize&&"auto"==e.resize&&o.setAttributeNS(null,"viewBox","0 0 "+a.width+" "+a.height),window.addEventListener("resize",(function(){c()})),window.dispatchEvent(new Event("resize")),a.setResize=function(t){e.onResize=t},a.changeAspect=function(t){e.aspect=t,a.height=a.width*e.aspect,o.setAttributeNS(null,"height",a.height)},a.changeHeight=function(t){a.height=t,e.aspect?e.aspect=a.height/a.width:e.height=t,o.setAttributeNS(null,"height",a.height)},a.triggerResize=function(){c()},a.svg=o,a}function c(){e.hasOwnProperty("width");var t=e.hasOwnProperty("height");e.hasOwnProperty("aspect"),a.width=r.clientWidth,o.setAttributeNS(null,"width",a.width),t||(a.height=a.width*e.aspect,o.setAttributeNS(null,"height",a.height)),a.aspect=a.height/a.width,a.scale=a.width/a.original_width,e.onResize&&e.onResize(a.width,a.height,a.scale,o)}console.log("Couldn't find a parent for elasticSVG making the selector '"+t+"'")}i.d(e,{default:()=>h})}},e={};function i(h){if(e[h])return e[h].exports;var n=e[h]={exports:{}};return t[h](n,n.exports,i),n.exports}return i.d=(t,e)=>{for(var h in e)i.o(e,h)&&!i.o(t,h)&&Object.defineProperty(t,h,{enumerable:!0,get:e[h]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i(89)})().default; |
75
index.js
@@ -1,2 +0,2 @@ | ||
// v0.0.8 | ||
// v0.1.1 | ||
@@ -6,5 +6,14 @@ export default function elasticSVG(selector, opts) { | ||
let hasWidth = opts.hasOwnProperty("width"); | ||
let hasHeight = opts.hasOwnProperty("height"); | ||
let hasAspect = opts.hasOwnProperty("aspect"); | ||
// containing DOM element, which defaults to body | ||
var parent = document.querySelectorAll(selector || "body"); | ||
if (selector instanceof Element) { | ||
var parent = selector; | ||
} else { | ||
var parent = document.querySelectorAll(selector || "body"); | ||
} | ||
if (!parent || !parent.length) { | ||
@@ -17,5 +26,9 @@ console.log("Couldn't find a parent for elasticSVG making the selector '" + selector + "'"); | ||
let initialWidth = parent.clientWidth; | ||
// you can specify a width if you like, or we'll snap to size of container | ||
var base = { | ||
width: typeof opts.width !== "undefined" ? opts.width : parent.clientWidth, | ||
width: null, | ||
height: null, | ||
aspect: null, | ||
scale: 1 | ||
@@ -25,15 +38,33 @@ }; | ||
// we need to remember the original width for scaling purposes | ||
base.original_width = base.width; | ||
// you can either specify the height or the aspect ratio. If neither is specified, refaults to roughly the golden ratio | ||
// you can either specify the height and width, which will computed the aspect ration, or one of these and the aspect ratio. | ||
// If neither is specified, defaults to roughly the golden ratio | ||
// specifying the height keeps the svg at a standard height and only resizes the width | ||
// specifying the aspect ratio resizes both | ||
if (typeof opts.height !== "undefined") { | ||
base.height = opts.height; | ||
base.aspect = base.height / base.width; | ||
} else { | ||
opts.aspect = typeof opts.aspect !== "undefined" ? opts.aspect : 0.618; | ||
base.height = base.width * opts.aspect; | ||
} | ||
if (hasWidth && hasHeight) { | ||
if (hasAspect) { | ||
console.log("Overriding aspect ratio since both `width` and `height` are specified"); | ||
opts.aspect = opts.height / opts.width; | ||
} | ||
base.width = opts.width; | ||
base.height = opts.height; | ||
} else { // if has neither an aspect or BOTH a width and height, default to approximately the golden ratio | ||
opts.aspect = opts.aspect || 0.618; | ||
if (hasWidth && !hasHeight) { | ||
base.width = opts.width; | ||
base.height = base.width * opts.aspect; | ||
} else if (hasHeight) { | ||
base.height = opts.height; | ||
base.width = base.height / opts.aspect; | ||
} else { // if only has aspect | ||
base.width = initialWidth; | ||
base.height = base.width * opts.aspect; | ||
} | ||
} | ||
base.original_width = base.width; | ||
// create a new SVG element | ||
@@ -53,11 +84,16 @@ var xmlns = "http://www.w3.org/2000/svg"; | ||
function resize() { | ||
let hasWidth = opts.hasOwnProperty("width"); | ||
let hasHeight = opts.hasOwnProperty("height"); | ||
let hasAspect = opts.hasOwnProperty("aspect"); | ||
base.width = parent.clientWidth; | ||
svg.setAttributeNS(null, "width", base.width); | ||
// only resize the height if aspect was specified instead of height | ||
if (opts.aspect) { | ||
base.height = base.width * opts.aspect; | ||
svg.setAttributeNS(null, "height", base.height); | ||
// if `height` is not specified, resize it to the aspect ratio | ||
if (!hasHeight) { | ||
base.height = base.width * opts.aspect; | ||
svg.setAttributeNS(null, "height", base.height); | ||
} | ||
base.aspect = base.height / base.width; | ||
base.scale = base.width / base.original_width; | ||
@@ -75,4 +111,7 @@ | ||
resize(); // call this on load since sometimes the initial conditions are wider than container | ||
// manually trigger a page resize and run the resize function once | ||
window.dispatchEvent(new Event('resize')); | ||
// resize(); // call this on load since sometimes the initial conditions are wider than container | ||
// methods | ||
@@ -79,0 +118,0 @@ base.setResize = function(f) { |
{ | ||
"name": "elastic-svg", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Responsive SVGs with no dependencies", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"build": "bundle-module --entry=./index.js --name=elasticSVG --env=browser --output_dir=./dist", | ||
"minify": "bundle-module --entry=./index.js --name=elasticSVG --env=browser --output_dir=./dist --min", | ||
"watch": "bundle-module --entry=./index.js --name=elasticSVG --env=browser --output_dir=./dist --watch" | ||
}, | ||
@@ -9,0 +11,0 @@ "repository": { |
# Elastic SVG elements | ||
======= | ||
v0.1.0 | ||
v0.1.1 | ||
@@ -37,2 +37,3 @@ Scalable Vector Graphics are one of the Web's most triumphant technologies, but they're not as responsive as they might be. This is a very lightweight, dependency-free library that generates `svg` elements that fit to their container and scale <em>or don't scale</em> as desired. | ||
| -------- | ----------- | | ||
| `selector` | The CSS3 query selector or HTML element in which to create the `<svg>` | | ||
| `width` | The initial width of the SVG. Defaults to width of parent | | ||
@@ -58,2 +59,3 @@ | `height` | The initial height of the SVG. Defaults to the aspect ratio. | | ||
## Change log | ||
+ *v0.1.1*: Allowing for elements as well as selectors | ||
+ *v0.1.0*: Removing an annoying console log | ||
@@ -60,0 +62,0 @@ + *v0.0.8*: Made an ES6 module and created `./dist` from external packager |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
426543
15
383
1
65
1