diff --git a/bower.json b/bower.json index e9eaad5..2136baa 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "svg-typewriter", "description": "A library for measuring, manipulating, and writing text on SVG.", - "version": "0.1.1", + "version": "0.1.2", "main": ["svgtypewriter.js"], "license": "MIT", "ignore": [ diff --git a/package.json b/package.json index f26cabf..df42596 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svgtypewriter", - "version": "0.1.1", + "version": "0.1.2", "description": "A library for measuring, manipulating, and writing text on SVG.", "repository": { "type": "git", diff --git a/src/measurers/cacheCharacterMeasurer.ts b/src/measurers/cacheCharacterMeasurer.ts index 23c1b42..5bb5689 100644 --- a/src/measurers/cacheCharacterMeasurer.ts +++ b/src/measurers/cacheCharacterMeasurer.ts @@ -16,5 +16,9 @@ module SVGTypewriter.Measurers { public _measureCharacter(c: string) { return this.cache.get(c); } + + public reset() { + this.cache.clear(); + } } } diff --git a/svgtypewriter.d.ts b/svgtypewriter.d.ts index 276ce2d..91c957d 100644 --- a/svgtypewriter.d.ts +++ b/svgtypewriter.d.ts @@ -205,5 +205,6 @@ declare module SVGTypewriter.Measurers { constructor(area: D3.Selection, className?: string); _measureCharacterNotFromCache(c: string): Dimensions; _measureCharacter(c: string): Dimensions; + reset(): void; } } diff --git a/svgtypewriter.js b/svgtypewriter.js index dc1ac23..c9b140c 100644 --- a/svgtypewriter.js +++ b/svgtypewriter.js @@ -1,7 +1,7 @@ /*! -SVG Typewriter 0.1.0 (https://github.com/palantir/svg-typewriter) +SVG Typewriter 0.1.2 (https://github.com/palantir/svg-typewriter) Copyright 2014 Palantir Technologies -Licensed under MIT (https://github.com/palantir/svg-typewriter/blob/master/LICENSE) +Licensed under MIT (https://github.com/palantir/svg-typewriter/blob/develop/LICENSE) */ /// @@ -945,6 +945,9 @@ var SVGTypewriter; CacheCharacterMeasurer.prototype._measureCharacter = function (c) { return this.cache.get(c); }; + CacheCharacterMeasurer.prototype.reset = function () { + this.cache.clear(); + }; return CacheCharacterMeasurer; })(Measurers.CharacterMeasurer); Measurers.CacheCharacterMeasurer = CacheCharacterMeasurer;