Socket
Socket
Sign inDemoInstall

mp-painter

Package Overview
Dependencies
1
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "mp-painter",
"version": "0.0.1",
"version": "0.0.2",
"description": "A declarative canvas lib using with mini-program, espacially with uniapp.",

@@ -5,0 +5,0 @@ "main": "src/lib/painter.js",

@@ -47,7 +47,8 @@ "use strict";

if (!(objectFit == "contain")) return [3 /*break*/, 2];
console.time("calculateContainSize");
return [4 /*yield*/, calculateContainSize(image)];
return [4 /*yield*/, calculateContainSize(image)
// console.timeEnd("calculateContainSize");
];
case 1:
// console.time("calculateContainSize");
contentSize = _b.sent();
console.timeEnd("calculateContainSize");
return [3 /*break*/, 3];

@@ -54,0 +55,0 @@ case 2:

@@ -31,5 +31,5 @@ import Painter, { PaintBaseOption } from "./painter";

if(objectFit == "contain"){
console.time("calculateContainSize");
// console.time("calculateContainSize");
contentSize = await calculateContainSize(image)
console.timeEnd("calculateContainSize");
// console.timeEnd("calculateContainSize");
} else { // fill

@@ -36,0 +36,0 @@ contentSize = { left, top, width, height }

@@ -58,6 +58,7 @@ "use strict";

var Painter = /** @class */ (function () {
function Painter(ctx, option) {
function Painter(ctx, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.platform, platform = _c === void 0 ? "mp-weixin" : _c, _d = _b.upx2px, upx2px = _d === void 0 ? uni ? uni.upx2px : function (x) { return x; } : _d;
this.ctx = ctx;
this.upx2px = option.upx2px;
this.platform = option.platform || "mp-weixin";
this.upx2px = upx2px;
this.platform = platform || "mp-weixin";
}

@@ -64,0 +65,0 @@ Painter.prototype.draw = function (paintObj) {

@@ -13,3 +13,3 @@ import { delay } from "../utils/delay";

interface IPanterOption {
upx2px: (upx: number) => number
upx2px?: (upx: number) => number
platform?: UniPlatforms

@@ -65,6 +65,9 @@ }

constructor(ctx: CanvasContext, option: IPanterOption){
constructor(ctx: CanvasContext, {
platform = "mp-weixin",
upx2px = uni ? uni.upx2px : x => x
}: IPanterOption = {}){
this.ctx = ctx;
this.upx2px = option.upx2px;
this.platform = option.platform || "mp-weixin";
this.upx2px = upx2px;
this.platform = platform;
}

@@ -71,0 +74,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc