Skip to content

Commit

Permalink
feat: sync element's width and height to context
Browse files Browse the repository at this point in the history
  • Loading branch information
zenozeng committed Jun 14, 2021
1 parent 134e9c5 commit 3e7435e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const mySerializedSVG = ctx.getSerializedSvg();

## CHANGELOG

### v2.0.3

- feat: sync element's width and height to context

### v2.0.2

- feat: Implement CanvasTransform Interface, https://github.com/gliffy/canvas2svg/pull/83
Expand Down
2 changes: 1 addition & 1 deletion context.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!!
* SVGCanvas v2.0.1
* SVGCanvas v2.0.3
* Draw on SVG using Canvas's 2D Context API.
*
* Licensed under the MIT license:
Expand Down
6 changes: 2 additions & 4 deletions element.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import Context from './context';

function SVGCanvasElement(options) {

var debug = options && options.debug;

this.ctx = new Context(100, 100, {debug: debug});
this.ctx = new Context(100, 100);
this.svg = this.ctx.__root;

// sync attributes to svg
Expand Down Expand Up @@ -34,7 +32,7 @@ function SVGCanvasElement(options) {
if (isNaN(val) || (typeof val === "undefined")) {
return;
}
_this.ctx['__'+prop] = val;
_this.ctx[prop] = val;
svg.setAttribute(prop, val);
return wrapper[prop] = val;
}
Expand Down

0 comments on commit 3e7435e

Please sign in to comment.