Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "karas", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "鸦", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -6,2 +6,1 @@ # karas(鸦) | ||
[![Build Status](https://travis-ci.org/karasjs/karas.svg?branch=master)](https://travis-ci.org/karasjs/karas) | ||
[![Dependency Status](https://david-dm.org/karasjs/karas.png)](https://david-dm.org/karasjs/karas) |
@@ -28,5 +28,8 @@ import Geom from './Geom'; | ||
} | ||
let pts = []; | ||
points.forEach(item => { | ||
item[0] = originX + item[0] * width; | ||
item[1] = originY + item[1] * height; | ||
pts.push([ | ||
originX + item[0] * width, | ||
originY + item[1] * height | ||
]); | ||
}); | ||
@@ -39,8 +42,8 @@ if(renderMode === mode.CANVAS) { | ||
ctx.beginPath(); | ||
ctx.moveTo(points[0][0], points[0][1]); | ||
for(let i = 1, len = points.length; i < len; i++) { | ||
let point = points[i]; | ||
ctx.moveTo(pts[0][0], pts[0][1]); | ||
for(let i = 1, len = pts.length; i < len; i++) { | ||
let point = pts[i]; | ||
ctx.lineTo(point[0], point[1]); | ||
} | ||
ctx.lineTo(points[0][0], points[0][1]); | ||
ctx.lineTo(pts[0][0], pts[0][1]); | ||
ctx.fill(); | ||
@@ -53,9 +56,9 @@ if(strokeWidth > 0) { | ||
else if(renderMode === mode.SVG) { | ||
let pts = ''; | ||
for(let i = 0, len = points.length; i < len; i++) { | ||
let point = points[i]; | ||
pts += `${point[0]},${point[1]} `; | ||
let s = ''; | ||
for(let i = 0, len = pts.length; i < len; i++) { | ||
let point = pts[i]; | ||
s += `${point[0]},${point[1]} `; | ||
} | ||
this.addGeom('polygon', [ | ||
['points', pts], | ||
['points', s], | ||
['fill', fill], | ||
@@ -62,0 +65,0 @@ ['stroke', stroke], |
@@ -35,3 +35,3 @@ import Geom from './Geom'; | ||
} | ||
let pts = this.__pts = []; | ||
let pts = []; | ||
if(origin === 'TOP_LEFT') { | ||
@@ -38,0 +38,0 @@ points.forEach(item => { |
@@ -79,3 +79,5 @@ import Event from '../util/Event'; | ||
sr.__host = this; | ||
sr.__traverse(ctx, defs, renderMode); | ||
if(!sr.isGeom()) { | ||
sr.__traverse(ctx, defs, renderMode); | ||
} | ||
} | ||
@@ -100,10 +102,10 @@ | ||
else { | ||
let style = this.props.style || {}; | ||
for(let i in style) { | ||
if(style.hasOwnProperty(i)) { | ||
sr.style[i] = style[i]; | ||
} | ||
} | ||
sr.__init(); | ||
} | ||
let style = this.props.style || {}; | ||
for(let i in style) { | ||
if(style.hasOwnProperty(i)) { | ||
sr.style[i] = style[i]; | ||
} | ||
} | ||
if(!(sr instanceof Text)) { | ||
@@ -110,0 +112,0 @@ this.__props.forEach(item => { |
@@ -921,8 +921,2 @@ import Xom from './Xom'; | ||
let ph = height + ptw + pbw; | ||
// 递归进行,遇到absolute/relative的设置新容器 | ||
children.forEach(item => { | ||
if(item instanceof Dom || item instanceof Component) { | ||
item.__layoutAbs(['absolute', 'relative'].indexOf(item.style.position) > -1 ? item : container); | ||
} | ||
}); | ||
// 对absolute的元素进行相对容器布局 | ||
@@ -1009,2 +1003,14 @@ absChildren.forEach(item => { | ||
}); | ||
// 递归进行,遇到absolute/relative的设置新容器 | ||
children.forEach(item => { | ||
if(item instanceof Dom) { | ||
item.__layoutAbs(['absolute', 'relative'].indexOf(item.style.position) > -1 ? item : container); | ||
} | ||
else if(item instanceof Component) { | ||
let sr = item.shadowRoot; | ||
if(sr instanceof Dom) { | ||
sr.__layoutAbs(sr); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -1011,0 +1017,0 @@ |
Sorry, the diff of this file is too big to display
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
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
746618
37
12153
6