@meta2d/core
Advanced tools
Comparing version 1.0.35 to 1.0.36
{ | ||
"name": "@meta2d/core", | ||
"version": "1.0.35", | ||
"version": "1.0.36", | ||
"description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,3 +12,3 @@ var __values = (this && this.__values) || function(o) { | ||
}; | ||
import { ctxFlip, ctxRotate, drawImage, setGlobalAlpha, getParent, } from '../pen'; | ||
import { ctxFlip, ctxRotate, drawImage, setGlobalAlpha, getParent, CanvasLayer, } from '../pen'; | ||
import { rgba } from '../utils'; | ||
@@ -109,3 +109,5 @@ import { createOffscreen } from './offscreen'; | ||
pen.calculative.inView && | ||
!pen.isBottom == !this.isBottom && // undefined == false 结果 false | ||
// !pen.isBottom == !this.isBottom && // undefined == false 结果 false | ||
((this.isBottom && pen.canvasLayer === CanvasLayer.CanvasImageBottom) || | ||
(!this.isBottom && pen.canvasLayer === CanvasLayer.CanvasImage)) && | ||
pen.image && | ||
@@ -208,3 +210,4 @@ pen.calculative.img && | ||
} | ||
if (pen.template) { | ||
// if (pen.template) { | ||
if (pen.canvasLayer === CanvasLayer.CanvasTemplate) { | ||
continue; | ||
@@ -243,3 +246,4 @@ } | ||
} | ||
if (pen.template) { | ||
// if (pen.template) { | ||
if (pen.canvasLayer === CanvasLayer.CanvasTemplate) { | ||
continue; | ||
@@ -272,3 +276,4 @@ } | ||
} | ||
if (pen.template) { | ||
// if (pen.template) { | ||
if (pen.canvasLayer === CanvasLayer.CanvasTemplate) { | ||
continue; | ||
@@ -275,0 +280,0 @@ } |
@@ -12,3 +12,3 @@ var __values = (this && this.__values) || function(o) { | ||
}; | ||
import { ctxFlip, ctxRotate, drawImage, setGlobalAlpha, renderPen, } from '../pen'; | ||
import { ctxFlip, ctxRotate, drawImage, setGlobalAlpha, renderPen, CanvasLayer, } from '../pen'; | ||
import { createOffscreen } from './offscreen'; | ||
@@ -95,4 +95,4 @@ var CanvasTemplate = /** @class */ (function () { | ||
var height = this.store.data.height || this.store.options.height; | ||
var x = this.store.data.x || this.store.options.x; | ||
var y = this.store.data.y || this.store.options.y; | ||
var x = this.store.data.x || this.store.options.x || 0; | ||
var y = this.store.data.y || this.store.options.y || 0; | ||
var background = this.store.data.background || this.store.options.background; | ||
@@ -102,4 +102,5 @@ if (background) { | ||
ctx.fillStyle = background; | ||
if (width && height && x && y) { | ||
ctx.globalAlpha = (_b = this.store.data.globalAlpha) !== null && _b !== void 0 ? _b : this.store.options.globalAlpha; | ||
if (width && height) { | ||
ctx.globalAlpha = | ||
(_b = this.store.data.globalAlpha) !== null && _b !== void 0 ? _b : this.store.options.globalAlpha; | ||
ctx.shadowOffsetX = this.store.options.shadowOffsetX; | ||
@@ -134,3 +135,6 @@ ctx.shadowOffsetY = this.store.options.shadowOffsetY; | ||
} | ||
if (pen.template && pen.calculative.inView) { | ||
if ( | ||
// pen.template | ||
pen.canvasLayer === CanvasLayer.CanvasTemplate | ||
&& pen.calculative.inView) { | ||
//非图片 | ||
@@ -198,4 +202,4 @@ renderPen(ctx, pen); | ||
var offset = size * 10; //补偿值 | ||
var newX = (startX - Math.ceil(m) * size); | ||
var newY = (startY - Math.ceil(n) * size); | ||
var newX = startX - Math.ceil(m) * size; | ||
var newY = startY - Math.ceil(n) * size; | ||
var endX = cW + newX + offset; | ||
@@ -202,0 +206,0 @@ var endY = cH + newY + offset; |
@@ -301,11 +301,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
else { | ||
if (pen.calculative.singleton && pen.calculative.singleton.div) { | ||
try { | ||
handleSaveImg(pen); | ||
} | ||
catch (e) { | ||
console.warn(e); | ||
pen.calculative.img = null; | ||
} | ||
} | ||
// if (pen.calculative.singleton && pen.calculative.singleton.div) { | ||
// try { | ||
// // handleSaveImg(pen); | ||
// } catch (e) { | ||
// console.warn(e); | ||
// pen.calculative.img = null; | ||
// } | ||
// } | ||
} | ||
@@ -312,0 +311,0 @@ } |
@@ -404,2 +404,16 @@ var __read = (this && this.__read) || function (o, n) { | ||
} | ||
var index = pen.calculative.worldAnchors.findIndex(function (anchor) { return anchor.id == from.id; }); | ||
if (index > 1) { | ||
var prev = pen.calculative.worldAnchors[index - 1]; | ||
if (prev.x === from.x && prev.y !== from.y) { | ||
//水平 | ||
pts.push({ x: to.x, y: from.y }); | ||
return pts; | ||
} | ||
else if (prev.y === from.y && prev.x !== from.x) { | ||
//垂直 | ||
pts.push({ x: from.x, y: to.y }); | ||
return pts; | ||
} | ||
} | ||
if (pen.calculative.worldAnchors.length) { | ||
@@ -406,0 +420,0 @@ to.isTemp = undefined; |
@@ -27,2 +27,8 @@ import { Point } from '../point'; | ||
} | ||
export declare enum CanvasLayer { | ||
CanvasTemplate = 1, | ||
CanvasImageBottom = 2, | ||
CanvasMain = 3, | ||
CanvasImage = 4 | ||
} | ||
export declare const needCalcTextRectProps: string[]; | ||
@@ -210,3 +216,7 @@ export declare const needSetPenProps: string[]; | ||
isRuleLine?: boolean; | ||
/** | ||
* @deprecated 改用 canvasLayer | ||
*/ | ||
isBottom?: boolean; | ||
canvasLayer?: CanvasLayer; | ||
form?: FormItem[]; | ||
@@ -230,2 +240,5 @@ lockedOnCombine?: LockState; | ||
blurBackground?: string; | ||
/** | ||
* @deprecated 改用 canvasLayer | ||
*/ | ||
template?: boolean; | ||
@@ -345,3 +358,7 @@ thumbImg?: string; | ||
imageDrawed?: boolean; | ||
/** | ||
* @deprecated 改用 canvasLayer | ||
*/ | ||
isBottom?: boolean; | ||
canvasLayer?: CanvasLayer; | ||
scale?: number; | ||
@@ -348,0 +365,0 @@ start?: number; |
@@ -28,2 +28,10 @@ export var PenType; | ||
})(Gradient || (Gradient = {})); | ||
//所在画布层 值和画布zIndex对应 | ||
export var CanvasLayer; | ||
(function (CanvasLayer) { | ||
CanvasLayer[CanvasLayer["CanvasTemplate"] = 1] = "CanvasTemplate"; | ||
CanvasLayer[CanvasLayer["CanvasImageBottom"] = 2] = "CanvasImageBottom"; | ||
CanvasLayer[CanvasLayer["CanvasMain"] = 3] = "CanvasMain"; | ||
CanvasLayer[CanvasLayer["CanvasImage"] = 4] = "CanvasImage"; //顶部图片层 | ||
})(CanvasLayer || (CanvasLayer = {})); | ||
// export enum Flip { | ||
@@ -30,0 +38,0 @@ // None, // 正常 |
@@ -24,2 +24,3 @@ var __assign = (this && this.__assign) || function () { | ||
import { default as mitt } from 'mitt'; | ||
import { CanvasLayer } from '../pen'; | ||
import { defaultOptions } from '../options'; | ||
@@ -77,3 +78,4 @@ import { globalStore } from './global'; | ||
var pen = _c.value; | ||
if (pen.template) { | ||
// if (pen.template) { | ||
if (pen.canvasLayer === CanvasLayer.CanvasTemplate) { | ||
store.templatePens[pen.id] = pen; | ||
@@ -80,0 +82,0 @@ } |
@@ -68,2 +68,5 @@ /** | ||
else { | ||
if (Number.isNaN(Number(o[key]))) { | ||
return "continue"; | ||
} | ||
o[key] = Number(o[key]) * value; | ||
@@ -70,0 +73,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
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
1684502
24026
14