@visactor/vrender-core
Advanced tools
Comparing version 0.22.0-vstory.7 to 0.22.0-vstory.8
@@ -721,3 +721,2 @@ "use strict"; | ||
exports.AnimateGroup1 = AnimateGroup1; | ||
//# sourceMappingURL=custom-animate.js.map | ||
exports.AnimateGroup1 = AnimateGroup1; |
@@ -23,2 +23,3 @@ "use strict"; | ||
__exportStar(require("./morphing"), exports), __exportStar(require("./timeline"), exports), | ||
__exportStar(require("./group-fade"), exports), __exportStar(require("./easing"), exports); | ||
__exportStar(require("./group-fade"), exports), __exportStar(require("./easing"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -79,4 +79,14 @@ "use strict"; | ||
} | ||
let fillStyle = "", globalAlpha = -1, currBgList = []; | ||
const bgList = [ currBgList ]; | ||
this.paragraphs.forEach(((paragraph, index) => { | ||
paragraph instanceof icon_1.RichTextIcon || paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height); | ||
if (paragraph instanceof icon_1.RichTextIcon) return; | ||
const data = paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height); | ||
data && (fillStyle === data.fillStyle && globalAlpha === data.globalAlpha || (currBgList = [], | ||
bgList.push(currBgList), fillStyle = data.fillStyle, globalAlpha = data.globalAlpha), | ||
currBgList.push(data)); | ||
})), bgList.forEach((bg => { | ||
if (0 === bg.length) return; | ||
const data = bg[0], end = bg[bg.length - 1]; | ||
ctx.fillStyle = data.fillStyle, ctx.globalAlpha = data.globalAlpha, ctx.fillRect(data.left, data.top, end.right - data.left, end.bottom - data.top); | ||
})), this.paragraphs.forEach(((paragraph, index) => { | ||
@@ -83,0 +93,0 @@ if (paragraph instanceof icon_1.RichTextIcon) return paragraph.setAttributes({ |
@@ -27,3 +27,10 @@ import type { IContext2d, IRichTextParagraphCharacter } from '../../interface'; | ||
updateWidth(): void; | ||
drawBackground(ctx: IContext2d, top: number, ascent: number, deltaLeft: number, isLineFirst: boolean, textAlign: string, lineHeight: number): void; | ||
drawBackground(ctx: IContext2d, top: number, ascent: number, deltaLeft: number, isLineFirst: boolean, textAlign: string, lineHeight: number): { | ||
fillStyle: string; | ||
globalAlpha: number; | ||
left: number; | ||
top: number; | ||
right: number; | ||
bottom: number; | ||
}; | ||
draw(ctx: IContext2d, top: number, ascent: number, deltaLeft: number, isLineFirst: boolean, textAlign: string, lineHeight: number): void; | ||
@@ -30,0 +37,0 @@ getWidthWithEllips(direction: string): number; |
@@ -57,18 +57,7 @@ "use strict"; | ||
} | ||
switch (this.character.script) { | ||
case "super": | ||
baseline -= this.ascent * (1 / 3); | ||
break; | ||
case "sub": | ||
baseline += this.descent / 2; | ||
} | ||
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), | ||
ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), | ||
left = 0, baseline = 0); | ||
const fillStyle = ctx.fillStyle, globalAlpha = ctx.globalAlpha; | ||
ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity); | ||
const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight); | ||
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top), | ||
ctx.fillStyle = fillStyle, ctx.globalAlpha = globalAlpha; | ||
return Object.assign(Object.assign({}, lrtb), { | ||
fillStyle: this.character.background, | ||
globalAlpha: this.character.backgroundOpacity | ||
}); | ||
} | ||
@@ -75,0 +64,0 @@ draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) { |
@@ -698,3 +698,2 @@ import { clamp, getDecimalPlaces, isArray, isNumber, isValidNumber, pi, pi2, Point, PointService } from "@visactor/vutils"; | ||
} | ||
} | ||
//# sourceMappingURL=custom-animate.js.map | ||
} |
@@ -15,2 +15,3 @@ export * from "./Ticker"; | ||
export * from "./easing"; | ||
export * from "./easing"; | ||
//# sourceMappingURL=index.js.map |
@@ -70,4 +70,14 @@ import { RichTextIcon } from "./icon"; | ||
} | ||
let fillStyle = "", globalAlpha = -1, currBgList = []; | ||
const bgList = [ currBgList ]; | ||
this.paragraphs.forEach(((paragraph, index) => { | ||
paragraph instanceof RichTextIcon || paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height); | ||
if (paragraph instanceof RichTextIcon) return; | ||
const data = paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height); | ||
data && (fillStyle === data.fillStyle && globalAlpha === data.globalAlpha || (currBgList = [], | ||
bgList.push(currBgList), fillStyle = data.fillStyle, globalAlpha = data.globalAlpha), | ||
currBgList.push(data)); | ||
})), bgList.forEach((bg => { | ||
if (0 === bg.length) return; | ||
const data = bg[0], end = bg[bg.length - 1]; | ||
ctx.fillStyle = data.fillStyle, ctx.globalAlpha = data.globalAlpha, ctx.fillRect(data.left, data.top, end.right - data.left, end.bottom - data.top); | ||
})), this.paragraphs.forEach(((paragraph, index) => { | ||
@@ -74,0 +84,0 @@ if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({ |
@@ -27,3 +27,10 @@ import type { IContext2d, IRichTextParagraphCharacter } from '../../interface'; | ||
updateWidth(): void; | ||
drawBackground(ctx: IContext2d, top: number, ascent: number, deltaLeft: number, isLineFirst: boolean, textAlign: string, lineHeight: number): void; | ||
drawBackground(ctx: IContext2d, top: number, ascent: number, deltaLeft: number, isLineFirst: boolean, textAlign: string, lineHeight: number): { | ||
fillStyle: string; | ||
globalAlpha: number; | ||
left: number; | ||
top: number; | ||
right: number; | ||
bottom: number; | ||
}; | ||
draw(ctx: IContext2d, top: number, ascent: number, deltaLeft: number, isLineFirst: boolean, textAlign: string, lineHeight: number): void; | ||
@@ -30,0 +37,0 @@ getWidthWithEllips(direction: string): number; |
@@ -53,18 +53,7 @@ import { calculateLineHeight } from "../../common/utils"; | ||
} | ||
switch (this.character.script) { | ||
case "super": | ||
baseline -= this.ascent * (1 / 3); | ||
break; | ||
case "sub": | ||
baseline += this.descent / 2; | ||
} | ||
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), | ||
ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), | ||
left = 0, baseline = 0); | ||
const fillStyle = ctx.fillStyle, globalAlpha = ctx.globalAlpha; | ||
ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity); | ||
const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight); | ||
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top), | ||
ctx.fillStyle = fillStyle, ctx.globalAlpha = globalAlpha; | ||
return Object.assign(Object.assign({}, lrtb), { | ||
fillStyle: this.character.background, | ||
globalAlpha: this.character.backgroundOpacity | ||
}); | ||
} | ||
@@ -71,0 +60,0 @@ draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) { |
{ | ||
"name": "@visactor/vrender-core", | ||
"version": "0.22.0-vstory.7", | ||
"version": "0.22.0-vstory.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "sideEffects": [ |
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
11065369
96421