/** * Created by TonyJiang on 16/8/26. */ import * as React from "react"; import {ReportItemDesigner} from "./ReportItemDesigner"; import {RectF} from "../../drawing/Unit"; import {BoxItem} from "../../items/BoxItem"; import {Border} from "../../items/properties/classes/Border"; import {KonvaMapping} from "../../drawing/KonvaMapping"; import {RectObjectPool} from "../../drawing/KonvaObjectPools"; export class BoxItemDesigner extends ReportItemDesigner{ //添加border render(bounds:RectF):any{ const parentNode = super.render(bounds); const item = this.item as BoxItem; const border:Border = item.border; //@TODO 后续支持各个border单独设置, 目前border样式统一, 所以直接从top上读取 const borderWidth = border.top.borderWidth; const borderStyle = border.top.borderStyle; const borderColor = border.top.borderColor; let props = { x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height, stroke: borderColor, strokeWidth: borderWidth, dash: KonvaMapping.getLineStyleValue(borderStyle) }; // const borderItem = new Konva.Rect(props); const borderItem = RectObjectPool.get(props); parentNode.add(borderItem); return parentNode; } }