UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

56 lines (55 loc) 1.5 kB
import { __extends } from "../../../../tslib/tslib.es6.mjs"; import Path from "../Path.mjs"; import { buildPath } from "../helper/roundRect.mjs"; import { subPixelOptimizeRect } from "../helper/subPixelOptimize.mjs"; var RectShape = function() { function RectShape2() { this.x = 0; this.y = 0; this.width = 0; this.height = 0; } return RectShape2; }(); var subPixelOptimizeOutputShape = {}; var Rect = function(_super) { __extends(Rect2, _super); function Rect2(opts) { return _super.call(this, opts) || this; } Rect2.prototype.getDefaultShape = function() { return new RectShape(); }; Rect2.prototype.buildPath = function(ctx, shape) { var x; var y; var width; var height; if (this.subPixelOptimize) { var optimizedShape = subPixelOptimizeRect(subPixelOptimizeOutputShape, shape, this.style); x = optimizedShape.x; y = optimizedShape.y; width = optimizedShape.width; height = optimizedShape.height; optimizedShape.r = shape.r; shape = optimizedShape; } else { x = shape.x; y = shape.y; width = shape.width; height = shape.height; } if (!shape.r) { ctx.rect(x, y, width, height); } else { buildPath(ctx, shape); } }; Rect2.prototype.isZeroArea = function() { return !this.shape.width || !this.shape.height; }; return Rect2; }(Path); Rect.prototype.type = "rect"; var Rect$1 = Rect; export { RectShape, Rect$1 as default };