@visactor/vrender-core 0.22.0-vstory.1 → 0.22.0-vstory.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/canvas/util.js +1 -2
- package/cjs/color-string/store.js +2 -1
- package/cjs/core/global.d.ts +0 -3
- package/cjs/core/global.js +1 -7
- package/cjs/core/global.js.map +1 -1
- package/cjs/graphic/builtin-symbol/utils.js +1 -1
- package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
- package/cjs/graphic/config.js +1 -0
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +1 -1
- package/cjs/graphic/graphic.js +5 -5
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +1 -1
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/richtext/line.js +13 -1
- package/cjs/graphic/richtext/line.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.d.ts +9 -1
- package/cjs/graphic/richtext/paragraph.js +50 -11
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/richtext/utils.js +4 -4
- package/cjs/graphic/richtext/utils.js.map +1 -1
- package/cjs/graphic/richtext.d.ts +2 -1
- package/cjs/graphic/richtext.js +10 -1
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/interface/global.d.ts +0 -1
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic/richText.d.ts +11 -0
- package/cjs/interface/graphic/richText.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -1
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/plugins/builtin-plugin/edit-module.d.ts +2 -1
- package/cjs/plugins/builtin-plugin/edit-module.js +20 -15
- package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +36 -10
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +322 -132
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +3 -2
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/resource-loader/loader.js +1 -1
- package/cjs/resource-loader/loader.js.map +1 -1
- package/dist/index.es.js +498 -110
- package/es/canvas/util.js +1 -2
- package/es/color-string/store.js +2 -1
- package/es/core/global.d.ts +0 -3
- package/es/core/global.js +1 -8
- package/es/core/global.js.map +1 -1
- package/es/graphic/builtin-symbol/utils.js +1 -1
- package/es/graphic/builtin-symbol/utils.js.map +1 -1
- package/es/graphic/config.js +1 -0
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic.d.ts +1 -1
- package/es/graphic/graphic.js +5 -5
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +1 -1
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/richtext/line.js +13 -1
- package/es/graphic/richtext/line.js.map +1 -1
- package/es/graphic/richtext/paragraph.d.ts +9 -1
- package/es/graphic/richtext/paragraph.js +50 -11
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/richtext/utils.js +4 -4
- package/es/graphic/richtext/utils.js.map +1 -1
- package/es/graphic/richtext.d.ts +2 -1
- package/es/graphic/richtext.js +10 -1
- package/es/graphic/richtext.js.map +1 -1
- package/es/interface/global.d.ts +0 -1
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic/richText.d.ts +11 -0
- package/es/interface/graphic/richText.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -1
- package/es/interface/graphic.js.map +1 -1
- package/es/plugins/builtin-plugin/edit-module.d.ts +2 -1
- package/es/plugins/builtin-plugin/edit-module.js +17 -13
- package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +36 -10
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +320 -131
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.d.ts +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +2 -2
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/resource-loader/loader.js +1 -1
- package/es/resource-loader/loader.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/builtin-plugin/richtext-edit-plugin.ts"],"names":[],"mappings":";;;AACA,6CAAkE;AAClE,sDAAmD;AACnD,2CAA8E;AAiB9E,2CAAwE;AACxE,+CAAuE;AACvE,mDAAgD;AAChD,wDAAkE;AAKlE,MAAM,SAAS;IAKb,YAAY,uBAA+B,EAAE,YAAoB,EAAE,EAAa;QAC9E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QACvD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,uBAAuB,KAAK,IAAI,CAAC,YAAY,CAAC;IAC5D,CAAC;IAED,oBAAoB;QAClB,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/E,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/E,IAAI,YAAY,KAAK,YAAY,EAAE;YACjC,OAAO,EAAE,CAAC;SACX;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,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AC1C,IAAI,UAAU,KAAK,KAAK,EAAE;oBACxB,OAAO;wBACL,QAAQ;wBACR,UAAU;qBACX,CAAC;iBACH;gBACD,UAAU,EAAE,CAAC;aACd;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IAOD,YAAY,CAAC,aAAsB,KAAK;QACtC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,OAAO,IAAI,CAAC;SACb;QACD,IACE,IAAI,CAAC,uBAAuB,IAAI,IAAI;YACpC,IAAI,CAAC,YAAY,IAAI,IAAI,EAEzB;YACA,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACpF;aAAM,IAAI,UAAU,EAAE;YACrB,OAAO,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACxD;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA12BD,gDA02BC","file":"richtext-edit-plugin.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { isObject, isString, max, merge } from '@visactor/vutils';\nimport { Generator } from '../../common/generator';\nimport { createGroup, createLine, createRect, RichText } from '../../graphic';\nimport type {\n IGroup,\n ILine,\n IPlugin,\n IPluginService,\n IRect,\n IRichText,\n IRichTextCharacter,\n IRichTextFrame,\n IRichTextIcon,\n IRichTextLine,\n IRichTextParagraph,\n IRichTextParagraphCharacter,\n ITicker,\n ITimeline\n} from '../../interface';\nimport { Animate, DefaultTicker, DefaultTimeline } from '../../animate';\nimport { EditModule, findConfigIndexByCursorIdx } from './edit-module';\nimport { application } from '../../application';\nimport { getWordStartEndIdx } from '../../graphic/richtext/utils';\n// import { testLetter, testLetter2 } from '../../graphic/richtext/utils';\n\ntype UpdateType = 'input' | 'change' | 'onfocus' | 'defocus' | 'selection' | 'dispatch';\n\nclass Selection {\n selectionStartCursorIdx: number;\n curCursorIdx: number;\n rt: IRichText;\n\n constructor(selectionStartCursorIdx: number, curCursorIdx: number, rt: IRichText) {\n this.curCursorIdx = curCursorIdx;\n this.selectionStartCursorIdx = selectionStartCursorIdx;\n this.rt = rt;\n }\n\n isEmpty(): boolean {\n return this.selectionStartCursorIdx === this.curCursorIdx;\n }\n\n getSelectionPureText(): string {\n const minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);\n const maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);\n if (minCursorIdx === maxCursorIdx) {\n return '';\n }\n const config = this.rt.attribute.textConfig as any;\n const startIdx = findConfigIndexByCursorIdx(config, Math.ceil(minCursorIdx));\n const endIdx = findConfigIndexByCursorIdx(config, Math.floor(maxCursorIdx));\n let str = '';\n for (let i = startIdx; i <= endIdx; i++) {\n str += config[i].text;\n }\n return str;\n }\n\n hasFormat(key: string): boolean {\n return this.getFormat(key) != null;\n }\n\n /**\n * 获取第idx中key的值\n * @param key\n * @param cursorIdx\n */\n _getFormat(key: string, cursorIdx: number) {\n if (!this.rt) {\n return null;\n }\n let idx = Math.round(cursorIdx);\n const config = this.rt.attribute.textConfig as any;\n for (let i = 0; i < config.length; i++) {\n if (config[i].text !== '\\n') {\n idx--;\n if (idx < 0) {\n return config[i][key];\n }\n }\n }\n return config[Math.min(idx, config.length - 1)][key] ?? (this.rt.attribute as any)[key];\n }\n getFormat(key: string): any {\n return this.getAllFormat(key)[0];\n }\n\n getAllFormat(key: string): any {\n const valSet = new Set();\n const minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);\n const maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);\n if (minCursorIdx === maxCursorIdx) {\n return [this._getFormat(key, minCursorIdx)];\n }\n for (let i = Math.ceil(minCursorIdx); i <= Math.floor(maxCursorIdx); i++) {\n const val = this._getFormat(key, i);\n val && valSet.add(val);\n }\n return Array.from(valSet.values());\n }\n}\n\nexport const FORMAT_TEXT_COMMAND = 'FORMAT_TEXT_COMMAND';\nexport const FORMAT_ELEMENT_COMMAND = 'FORMAT_ELEMENT_COMMAND';\nexport class RichTextEditPlugin implements IPlugin {\n name: 'RichTextEditPlugin' = 'RichTextEditPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n // 是否正在编辑\n editing: boolean = false;\n // 鼠标是否按下,判断是否展示selection\n pointerDown: boolean = false;\n\n // selection组件\n editLine: ILine;\n editBg: IGroup;\n ticker: ITicker;\n timeline: ITimeline;\n\n currRt: IRichText;\n\n // 当前的cursor信息\n // 0.1为第一个字符右侧, -0.1为第一个字符左侧\n // 1.1为第二个字符右侧,0.9为第二个字符左侧\n curCursorIdx: number;\n selectionStartCursorIdx: number;\n startCursorPos?: IPointLike;\n\n editModule: EditModule;\n\n protected commandCbs: Map<string, Array<(payload: any, p: RichTextEditPlugin) => void>>;\n protected updateCbs: Array<(type: UpdateType, p: RichTextEditPlugin) => void>;\n\n // 富文本外部有align或者baseline的时候,需要对光标做偏移\n protected declare deltaX: number;\n protected declare deltaY: number;\n\n // static splitText(text: string) {\n // // 😁这种emoji长度算两个,所以得处理一下\n // return Array.from(text);\n // }\n\n static tryUpdateRichtext(richtext: IRichText) {\n const cache = richtext.getFrameCache();\n if (!RichText.AllSingleCharacter(cache)) {\n const tc = RichText.TransformTextConfig2SingleCharacter(richtext.attribute.textConfig);\n // richtext.attribute.textConfig.forEach((item: IRichTextParagraphCharacter) => {\n // const textList = RichTextEditPlugin.splitText(item.text.toString());\n // if (isString(item.text) && textList.length > 1) {\n // // 拆分\n // for (let i = 0; i < textList.length; i++) {\n // const t = textList[i];\n // tc.push({ ...item, text: t });\n // }\n // } else {\n // tc.push(item);\n // }\n // });\n richtext.setAttributes({ textConfig: tc });\n richtext.doUpdateFrameCache(tc);\n }\n }\n\n static CreateSelection(rt: IRichText) {\n if (!rt) {\n return null;\n }\n const { textConfig = [] } = rt.attribute;\n return new Selection(0, textConfig.length - 1, rt);\n }\n\n constructor() {\n this.commandCbs = new Map();\n this.commandCbs.set(FORMAT_TEXT_COMMAND, [this.formatTextCommandCb]);\n this.updateCbs = [];\n this.timeline = new DefaultTimeline();\n this.ticker = new DefaultTicker([this.timeline]);\n this.deltaX = 0;\n this.deltaY = 0;\n }\n\n formatTextCommandCb(payload: string, p: RichTextEditPlugin) {\n const rt = p.currRt;\n if (!rt) {\n return;\n }\n const selectionData = p.getSelection();\n if (!selectionData) {\n return;\n }\n const { selectionStartCursorIdx, curCursorIdx } = selectionData;\n const minCursorIdx = Math.min(selectionStartCursorIdx, curCursorIdx);\n const maxCursorIdx = Math.max(selectionStartCursorIdx, curCursorIdx);\n const minConfigIdx = findConfigIndexByCursorIdx(rt.attribute.textConfig, minCursorIdx);\n const maxConfigIdx = findConfigIndexByCursorIdx(rt.attribute.textConfig, maxCursorIdx);\n const config = rt.attribute.textConfig.slice(minConfigIdx, maxConfigIdx);\n if (payload === 'bold') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.fontWeight = 'bold'));\n } else if (payload === 'italic') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.fontStyle = 'italic'));\n } else if (payload === 'underline') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.underline = true));\n } else if (payload === 'lineThrough') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.lineThrough = true));\n } else if (isObject(payload)) {\n config.forEach((item: IRichTextParagraphCharacter) => merge(item, payload));\n }\n rt.setAttributes(rt.attribute);\n }\n\n dispatchCommand(command: string, payload: any) {\n const cbs = this.commandCbs.get(command);\n cbs && cbs.forEach(cb => cb(payload, this));\n this.updateCbs.forEach(cb => cb('dispatch', this));\n }\n\n registerCommand(command: string, cb: (payload: any, p: RichTextEditPlugin) => void) {\n const cbs: Array<(payload: any, p: RichTextEditPlugin) => void> = this.commandCbs.get(command) || [];\n cbs.push(cb);\n }\n\n registerUpdateListener(cb: (type: UpdateType, p: RichTextEditPlugin) => void) {\n const cbs = this.updateCbs || [];\n cbs.push(cb);\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n this.editModule = new EditModule();\n // context.stage.on('click', this.handleClick);\n context.stage.on('pointermove', this.handleMove);\n context.stage.on('pointerdown', this.handlePointerDown);\n context.stage.on('pointerup', this.handlePointerUp);\n context.stage.on('pointerleave', this.handlePointerUp);\n context.stage.on('dblclick', this.handleDBLClick);\n application.global.addEventListener('keydown', this.handleKeyDown);\n\n this.editModule.onInput(this.handleInput);\n this.editModule.onChange(this.handleChange);\n this.editModule.onFocusOut(this.handleFocusOut);\n }\n\n copyToClipboard(e: KeyboardEvent): boolean {\n if (\n (application.global.isMacOS() && e.metaKey && e.key === 'c') ||\n (!application.global.isMacOS() && e.ctrlKey && e.key === 'c')\n ) {\n const selection = this.getSelection();\n const text = selection.getSelectionPureText();\n application.global.copyToClipBoard(text);\n e.preventDefault();\n return true;\n }\n return false;\n }\n\n /**\n * 选中某一个区间,startIdx和endIdx分别是开始结束的光标位置\n * 设置光标为endIdx,设置开始位置为startIdx\n * @param startIdx 开始位置\n * @param endIdx 结束位置\n * @returns\n */\n selectionRange(startIdx: number, endIdx: number) {\n const currRt = this.currRt;\n if (!currRt) {\n return;\n }\n const cache = currRt.getFrameCache();\n if (!cache) {\n return;\n }\n // 对startIdx和endIdx约束\n const { lines } = cache;\n const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;\n if (startIdx > endIdx) {\n [startIdx, endIdx] = [endIdx, startIdx];\n }\n startIdx = Math.min(Math.max(startIdx, -0.1), totalCursorCount + 0.1);\n endIdx = Math.min(Math.max(endIdx, -0.1), totalCursorCount + 0.1);\n\n this.curCursorIdx = endIdx;\n this.selectionStartCursorIdx = startIdx;\n const { x, y1, y2 } = this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx, this.currRt);\n this.startCursorPos = { x, y: (y1 + y2) / 2 };\n const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);\n this._tryShowSelection(pos, cache);\n }\n\n fullSelection(e: KeyboardEvent) {\n if (\n (application.global.isMacOS() && e.metaKey && e.key === 'a') ||\n (!application.global.isMacOS() && e.ctrlKey && e.key === 'a')\n ) {\n const currRt = this.currRt;\n if (!currRt) {\n return;\n }\n const cache = currRt.getFrameCache();\n if (!cache) {\n return;\n }\n const { lines } = cache;\n const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;\n this.selectionRange(-0.1, totalCursorCount + 0.1);\n\n e.preventDefault();\n return true;\n }\n return false;\n }\n\n directKey(e: KeyboardEvent) {\n if (!(e.key === 'ArrowUp' || e.key === 'ArrowDown' || e.key === 'ArrowLeft' || e.key === 'ArrowRight')) {\n return false;\n }\n const cache = this.currRt.getFrameCache();\n if (!cache) {\n return false;\n }\n let x = 0;\n let y = 0;\n if (e.key === 'ArrowUp') {\n y = -1;\n } else if (e.key === 'ArrowDown') {\n y = 1;\n } else if (e.key === 'ArrowLeft') {\n x = -1;\n } else if (e.key === 'ArrowRight') {\n x = 1;\n }\n\n // const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n const { lineInfo, columnInfo } = this.getColumnByIndex(cache, Math.round(this.curCursorIdx));\n const { lines } = cache;\n const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;\n if (x) {\n // 快接近首尾需要特殊处理\n if (\n x > 0 &&\n columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 2] &&\n this.curCursorIdx < Math.round(this.curCursorIdx)\n ) {\n this.curCursorIdx = this.curCursorIdx + 0.2;\n } else if (\n x > 0 &&\n columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 1] &&\n this.curCursorIdx > Math.round(this.curCursorIdx)\n ) {\n this.curCursorIdx = this.curCursorIdx + 1 - 0.2;\n } else if (x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx > Math.round(this.curCursorIdx)) {\n this.curCursorIdx = this.curCursorIdx - 0.2;\n } else if (x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx < Math.round(this.curCursorIdx)) {\n this.curCursorIdx = this.curCursorIdx - 1 + 0.2;\n } else {\n this.curCursorIdx += x;\n }\n if (this.curCursorIdx < -0.1) {\n this.curCursorIdx = -0.1;\n } else if (this.curCursorIdx > totalCursorCount + 0.1) {\n this.curCursorIdx = totalCursorCount + 0.1;\n }\n\n const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);\n this.hideSelection();\n }\n\n if (y) {\n if (y > 0 && lineInfo === cache.lines[cache.lines.length - 1]) {\n return;\n }\n if (y < 0 && lineInfo === cache.lines[0]) {\n return;\n }\n const lineIdx = cache.lines.findIndex(item => item === lineInfo) + y;\n if (lineIdx < 0 || lineIdx >= cache.lines.length) {\n return;\n }\n const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n const posX = pos.x;\n let posY = (pos.y1 + pos.y2) / 2;\n posY += y * lineInfo.height;\n const nextLineInfo = cache.lines[lineIdx];\n const { columnInfo, delta } = this.getColumnAndIndexByLinePoint(nextLineInfo, { x: posX, y: posY });\n if (!columnInfo) {\n return;\n }\n let cursorIdx = this.getColumnIndex(cache, columnInfo) + delta;\n const data = this.computedCursorPosByCursorIdx(cursorIdx, this.currRt);\n\n if (cursorIdx < -0.1) {\n cursorIdx = -0.1;\n } else if (cursorIdx > totalCursorCount + 0.1) {\n cursorIdx = totalCursorCount + 0.1;\n }\n\n this.curCursorIdx = cursorIdx;\n this.selectionStartCursorIdx = cursorIdx;\n this.setCursorAndTextArea(data.x, data.y1, data.y2, this.currRt);\n }\n\n return true;\n }\n\n handleKeyDown = (e: KeyboardEvent) => {\n if (!(this.currRt && this.editing)) {\n return;\n }\n // 复制到剪贴板\n // cmd/ctl + C\n if (this.copyToClipboard(e)) {\n return;\n }\n // 全选\n // cmd/ctl + A\n if (this.fullSelection(e)) {\n return;\n }\n // 方向键\n // 上、下、左、右\n if (this.directKey(e)) {\n return;\n }\n };\n\n handleInput = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => {\n // 修改cursor的位置,但并不同步到curIdx,因为这可能是临时的\n // const p = this.getPointByColumnIdx(cursorIdx, rt, orient);\n // console.log(this.curCursorIdx, cursorIdx);\n this.hideSelection();\n // this.setCursor(p.x, p.y1, p.y2);\n this.updateCbs.forEach(cb => cb('input', this));\n };\n\n handleChange = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => {\n // 修改cursor的位置,并同步到editModule\n this.curCursorIdx = cursorIdx;\n this.selectionStartCursorIdx = cursorIdx;\n const p = this.computedCursorPosByCursorIdx(cursorIdx, rt);\n this.setCursorAndTextArea(p.x, p.y1, p.y2, rt);\n this.hideSelection();\n this.updateCbs.forEach(cb => cb('change', this));\n };\n\n handleFocusIn = () => {\n // this.updateCbs.forEach(cb => cb(this.editing ? 'onfocus' : 'defocus', this));\n };\n\n handleFocusOut = () => {\n this.editing = false;\n this.deFocus();\n this.pointerDown = false;\n this.triggerRender();\n this.updateCbs.forEach(cb => cb('defocus', this));\n };\n\n deactivate(context: IPluginService): void {\n // context.stage.off('pointerdown', this.handleClick);\n context.stage.off('pointermove', this.handleMove);\n context.stage.off('pointerdown', this.handlePointerDown);\n context.stage.off('pointerup', this.handlePointerUp);\n context.stage.off('pointerleave', this.handlePointerUp);\n context.stage.off('dblclick', this.handleDBLClick);\n\n application.global.addEventListener('keydown', this.handleKeyDown);\n }\n\n handleMove = (e: PointerEvent) => {\n if (!this.isRichtext(e)) {\n return;\n }\n this.currRt = e.target as IRichText;\n this.handleEnter(e);\n (e.target as any).once('pointerleave', this.handleLeave);\n\n this.tryShowSelection(e, false);\n };\n\n // 鼠标进入\n handleEnter = (e: PointerEvent) => {\n this.editing = true;\n this.pluginService.stage.setCursor('text');\n };\n\n // 鼠标离开\n handleLeave = (e: PointerEvent) => {\n this.editing = false;\n this.pluginService.stage.setCursor('default');\n };\n\n handlePointerDown = (e: PointerEvent) => {\n if (this.editing) {\n this.onFocus(e);\n } else {\n this.deFocus();\n }\n this.triggerRender();\n this.pointerDown = true;\n this.updateCbs.forEach(cb => cb(this.editing ? 'onfocus' : 'defocus', this));\n };\n handlePointerUp = (e: PointerEvent) => {\n this.pointerDown = false;\n };\n handleDBLClick = (e: PointerEvent) => {\n if (!this.editing) {\n return;\n }\n\n this.tryShowSelection(e, true);\n };\n\n onFocus(e: PointerEvent) {\n this.deFocus();\n this.currRt = e.target as IRichText;\n\n // 创建shadowGraphic\n const target = e.target as IRichText;\n RichTextEditPlugin.tryUpdateRichtext(target);\n const shadowRoot = target.attachShadow();\n const cache = target.getFrameCache();\n if (!cache) {\n return;\n }\n // 计算全局偏移\n this.computeGlobalDelta(cache);\n\n // 添加cursor节点,shadowRoot在上面\n shadowRoot.setAttributes({ shadowRootIdx: 1, pickable: false, x: this.deltaX, y: this.deltaY });\n if (!this.editLine) {\n const line = createLine({ x: 0, y: 0, lineWidth: 1, stroke: 'black' });\n // 不使用stage的Ticker,避免影响其他的动画以及受到其他动画影响\n this.addAnimateToLine(line);\n this.editLine = line;\n this.ticker.start(true);\n\n const g = createGroup({ x: 0, y: 0, width: 0, height: 0 });\n this.editBg = g;\n shadowRoot.add(this.editLine);\n shadowRoot.add(this.editBg);\n }\n\n const data = this.computedCursorPosByEvent(e, cache);\n\n if (data) {\n const { x, y1, y2, cursorIndex } = data;\n this.startCursorPos = { x, y: (y1 + y2) / 2 };\n this.curCursorIdx = cursorIndex;\n this.selectionStartCursorIdx = cursorIndex;\n this.setCursorAndTextArea(x, y1, y2, target);\n }\n }\n\n protected deFocus() {\n const target = this.currRt as IRichText;\n if (!target) {\n return;\n }\n target.detachShadow();\n this.currRt = null;\n if (this.editLine) {\n this.editLine.parent.removeChild(this.editLine);\n this.editLine.release();\n this.editLine = null;\n\n this.editBg.parent.removeChild(this.editBg);\n this.editBg.release();\n this.editBg = null;\n }\n }\n\n protected addAnimateToLine(line: ILine) {\n line.animates &&\n line.animates.forEach(animate => {\n animate.stop();\n animate.release();\n });\n const animate = line.animate();\n animate.setTimeline(this.timeline);\n animate.to({ opacity: 1 }, 10, 'linear').wait(700).to({ opacity: 0 }, 10, 'linear').wait(700).loop(Infinity);\n }\n\n // 显示selection\n tryShowSelection(e: PointerEvent, dblclick: boolean) {\n const cache = (e.target as IRichText).getFrameCache();\n if (!(cache && this.editBg && this.startCursorPos)) {\n return;\n }\n\n if (!dblclick) {\n if (this.pointerDown) {\n const currCursorData = this.computedCursorPosByEvent(e, cache);\n if (!currCursorData) {\n return;\n }\n this.curCursorIdx = currCursorData.cursorIndex;\n this._tryShowSelection(currCursorData, cache);\n }\n } else {\n const currCursorData = this.computedCursorPosByEvent(e, cache);\n if (!currCursorData) {\n return;\n }\n // const curCursorIdx = currCursorData.cursorIndex;\n const lineInfo = currCursorData.lineInfo;\n const columnIndex = lineInfo.paragraphs.findIndex(item => item === currCursorData.columnInfo);\n if (columnIndex < 0) {\n return;\n }\n const str = lineInfo.paragraphs.reduce((str, item) => {\n return str + item.text;\n }, '');\n\n let idx = 0;\n for (let i = 0; i < cache.lines.length; i++) {\n const line = cache.lines[i];\n if (line === lineInfo) {\n break;\n }\n idx += line.paragraphs.length;\n }\n\n const { startIdx, endIdx } = getWordStartEndIdx(str, columnIndex);\n\n this.selectionRange(idx + startIdx - 0.1, idx + endIdx - 0.1);\n }\n }\n\n _tryShowSelection(\n currCursorData: {\n x: any;\n y1: number;\n y2: number;\n },\n cache: IRichTextFrame\n ) {\n let startCursorPos = this.startCursorPos;\n let endCursorPos = {\n x: currCursorData.x,\n y: (currCursorData.y1 + currCursorData.y2) / 2\n };\n let line0Info = this.getLineByPoint(cache, startCursorPos);\n let line1Info = this.getLineByPoint(cache, endCursorPos);\n\n if (\n startCursorPos.y > endCursorPos.y ||\n (startCursorPos.y === endCursorPos.y && startCursorPos.x > endCursorPos.x)\n ) {\n [startCursorPos, endCursorPos] = [endCursorPos, startCursorPos];\n [line1Info, line0Info] = [line0Info, line1Info];\n }\n\n this.hideSelection();\n if (line0Info === line1Info) {\n // 同行\n this.editBg.setAttributes({\n x: startCursorPos.x,\n y: line0Info.top,\n width: endCursorPos.x - startCursorPos.x,\n height: line0Info.height,\n fill: '#336df4',\n fillOpacity: 0.2\n });\n } else {\n this.editBg.setAttributes({ x: 0, y: line0Info.top, width: 0, height: 0 });\n const startIdx = cache.lines.findIndex(item => item === line0Info);\n const endIdx = cache.lines.findIndex(item => item === line1Info);\n let y = 0;\n for (let i = startIdx; i <= endIdx; i++) {\n const line = cache.lines[i];\n if (i === startIdx) {\n const p = line.paragraphs[line.paragraphs.length - 1];\n this.editBg.add(\n createRect({\n x: startCursorPos.x,\n y,\n width: p.left + p.width - startCursorPos.x,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n } else if (i === endIdx) {\n const p = line.paragraphs[0];\n this.editBg.add(\n createRect({\n x: p.left,\n y,\n width: endCursorPos.x - p.left,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n } else {\n const p0 = line.paragraphs[0];\n const p1 = line.paragraphs[line.paragraphs.length - 1];\n this.editBg.add(\n createRect({\n x: p0.left,\n y,\n width: p1.left + p1.width - p0.left,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n }\n y += line.height;\n }\n }\n\n this.setCursorAndTextArea(currCursorData.x, currCursorData.y1 + 2, currCursorData.y2 - 2, this.currRt as IRichText);\n\n this.triggerRender();\n this.updateCbs.forEach(cb => cb('selection', this));\n }\n\n hideSelection() {\n if (this.editBg) {\n this.editBg.removeAllChild();\n this.editBg.setAttributes({ fill: 'transparent' });\n }\n }\n\n protected getLineByPoint(cache: IRichTextFrame, p1: IPointLike): IRichTextLine {\n let lineInfo = cache.lines[0];\n for (let i = 0; i < cache.lines.length; i++) {\n if (lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y) {\n break;\n }\n lineInfo = cache.lines[i + 1];\n }\n\n return lineInfo;\n }\n protected getColumnAndIndexByLinePoint(\n lineInfo: IRichTextLine,\n p1: IPointLike\n ): {\n columnInfo: IRichTextParagraph | IRichTextIcon;\n delta: number;\n } {\n let columnInfo = lineInfo.paragraphs[0];\n let delta = 0;\n if (lineInfo.paragraphs.length) {\n const start = lineInfo.paragraphs[0];\n const end = lineInfo.paragraphs[lineInfo.paragraphs.length - 1];\n if (p1.x <= start.left) {\n delta = -0.1;\n columnInfo = start;\n } else if (p1.x >= end.left + end.width) {\n delta = 0.1;\n columnInfo = end;\n }\n }\n\n if (!delta) {\n for (let i = 0; i < lineInfo.paragraphs.length; i++) {\n columnInfo = lineInfo.paragraphs[i];\n if (columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x) {\n if (p1.x > columnInfo.left + columnInfo.width / 2) {\n delta = 0.1;\n } else {\n delta = -0.1;\n }\n break;\n }\n }\n }\n\n return {\n columnInfo,\n delta\n };\n }\n /* 工具函数 */\n /**\n * 根据给定的ParagraphInfo得到对应的index\n * @param cache 富文本缓存\n * @param cInfo ParagraphInfo\n * @returns\n */\n protected getColumnIndex(cache: IRichTextFrame, cInfo: IRichTextParagraph | IRichTextIcon) {\n // TODO 【注意】认为cache都是单个字符拆分的\n let inputIndex = -1;\n for (let i = 0; i < cache.lines.length; i++) {\n const line = cache.lines[i];\n for (let j = 0; j < line.paragraphs.length; j++) {\n inputIndex++;\n if (cInfo === line.paragraphs[j]) {\n return inputIndex;\n }\n }\n }\n return -1;\n }\n\n protected isRichtext(e: PointerEvent) {\n return !!(e.target && (e.target as any).type === 'richtext' && (e.target as any).attribute.editable);\n }\n\n // 如果没有开自动渲染,得触发重绘\n protected triggerRender() {\n this.pluginService.stage.renderNextFrame();\n }\n\n protected computeGlobalDelta(cache: IRichTextFrame) {\n this.deltaX = 0;\n this.deltaY = 0;\n const height = cache.height;\n const actualHeight = cache.actualHeight;\n const width = cache.lines.reduce((w, item) => Math.max(w, item.actualWidth), 0);\n if (cache.globalAlign === 'center') {\n this.deltaX = -width / 2;\n } else if (cache.globalAlign === 'right') {\n this.deltaX = -width;\n }\n if (cache.verticalDirection === 'middle') {\n this.deltaY = height / 2 - actualHeight / 2;\n } else if (cache.verticalDirection === 'bottom') {\n this.deltaY = height - actualHeight;\n }\n }\n\n protected getEventPosition(e: PointerEvent): IPointLike {\n const p = this.pluginService.stage.eventPointTransform(e);\n\n const p1 = { x: 0, y: 0 };\n (e.target as IRichText).globalTransMatrix.transformPoint(p, p1);\n p1.x -= this.deltaX;\n p1.y -= this.deltaY;\n return p1;\n }\n\n protected setCursorAndTextArea(x: number, y1: number, y2: number, rt: IRichText) {\n this.editLine.setAttributes({\n points: [\n { x, y: y1 },\n { x, y: y2 }\n ]\n });\n this.addAnimateToLine(this.editLine);\n const out = { x: 0, y: 0 };\n rt.globalTransMatrix.getInverse().transformPoint({ x, y: y1 }, out);\n // TODO 考虑stage变换\n const { left, top } = this.pluginService.stage.window.getBoundingClientRect();\n out.x += left;\n out.y += top;\n\n this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);\n }\n\n /**\n * 根据Event算出光标位置等信息\n * @param e Event\n * @param cache 富文本缓存\n * @returns\n */\n protected computedCursorPosByEvent(e: PointerEvent, cache: IRichTextFrame) {\n const p1 = this.getEventPosition(e);\n const lineInfo = this.getLineByPoint(cache, p1);\n if (!lineInfo) {\n return;\n }\n\n const { columnInfo, delta } = this.getColumnAndIndexByLinePoint(lineInfo, p1);\n if (!columnInfo) {\n return;\n }\n\n let y1 = lineInfo.top;\n let y2 = lineInfo.top + lineInfo.height;\n y1 += 2;\n y2 -= 2;\n\n let cursorIndex = this.getColumnIndex(cache, columnInfo);\n cursorIndex += delta;\n const x = columnInfo.left + (delta > 0 ? columnInfo.width : 0);\n\n return {\n x,\n y1,\n y2,\n cursorIndex,\n lineInfo,\n columnInfo\n };\n }\n\n /**\n * 根据cursorIdx计算出点的位置\n * @param cursorIdx index\n * @param rt 富文本\n * @returns\n */\n protected computedCursorPosByCursorIdx(cursorIdx: number, rt: IRichText) {\n const idx = Math.round(cursorIdx);\n const leftRight = cursorIdx - idx; // >0 向右,<0 向左\n const cache = rt.getFrameCache();\n const column = this.getColumnByIndex(cache, idx);\n const height = rt.attribute.fontSize ?? (rt.attribute.textConfig?.[0] as any)?.fontSize;\n if (!column) {\n return {\n x: 0,\n y1: 0,\n y2: height\n };\n }\n const { lineInfo, columnInfo } = column;\n let y1 = lineInfo.top;\n let y2 = lineInfo.top + lineInfo.height;\n const x = columnInfo.left + (leftRight < 0 ? 0 : columnInfo.width);\n y1 += 2;\n y2 -= 2;\n\n return { x, y1, y2 };\n }\n\n /**\n * 根据index获取columnInfo\n * @param cache 缓存\n * @param index index\n * @returns\n */\n protected getColumnByIndex(\n cache: IRichTextFrame,\n index: number\n ): {\n lineInfo: IRichTextLine;\n columnInfo: IRichTextParagraph | IRichTextIcon;\n } | null {\n // TODO 认为都是单个字符拆分的\n for (let i = 0, inputIndex = 0; i < cache.lines.length; i++) {\n const lineInfo = cache.lines[i];\n for (let j = 0; j < lineInfo.paragraphs.length; j++) {\n const columnInfo = lineInfo.paragraphs[j];\n if (inputIndex === index) {\n return {\n lineInfo,\n columnInfo\n };\n }\n inputIndex++;\n }\n }\n return null;\n }\n\n release() {\n this.deactivate(this.pluginService);\n this.editModule.release();\n }\n\n /**\n * 获取当前选择的区间范围\n * @param defaultAll 如果force为true,又没有选择,则认为选择了所有然后进行匹配,如果为false,则认为什么都没有选择,返回null\n * @returns\n */\n getSelection(defaultAll: boolean = false) {\n if (!this.currRt) {\n return null;\n }\n if (\n this.selectionStartCursorIdx != null &&\n this.curCursorIdx != null\n // this.selectionStartCursorIdx !== this.curCursorIdx &&\n ) {\n return new Selection(this.selectionStartCursorIdx, this.curCursorIdx, this.currRt);\n } else if (defaultAll) {\n return RichTextEditPlugin.CreateSelection(this.currRt);\n }\n return null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugins/builtin-plugin/richtext-edit-plugin.ts"],"names":[],"mappings":";;;AACA,6CAAkE;AAClE,sDAAmD;AACnD,2CAQuB;AAiBvB,2CAAwE;AACxE,+CAAkG;AAClG,mDAAgD;AAChD,wDAAkE;AAalE,MAAM,SAAS;IAKb,YAAY,uBAA+B,EAAE,YAAoB,EAAE,EAAa;QAC9E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QACvD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,uBAAuB,KAAK,IAAI,CAAC,YAAY,CAAC;IAC5D,CAAC;IAED,oBAAoB;QAClB,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/E,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/E,IAAI,YAAY,KAAK,YAAY,EAAE;YACjC,OAAO,EAAE,CAAC;SACX;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,UAAiB,CAAC;QACnD,MAAM,QAAQ,GAAG,IAAA,wCAA0B,EAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC7E,MAAM,MAAM,GAAG,IAAA,wCAA0B,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5E,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC,IAAI,MAAM,EAAE,CA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AC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAES,wBAAwB,CAAC,WAAmB;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;SACR;QAED,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAI,EAAE,GAAG,CAAC,CAAC;QACX,IAAI,EAAE,GAAG,CAAC,CAAC;QACX,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,IAAI,UAAU,GAAG,IAAI,CAAC;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,4BAA4B,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACtE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACX,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACb,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACb,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACzB,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAE7B,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAS,EAAE;YAC3C,CAAC;YACD,EAAE;YACF,EAAE;YACF,WAAW;YACX,QAAQ;YACR,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF;AA7rCD,gDA6rCC","file":"richtext-edit-plugin.js","sourcesContent":["import type { IAABBBounds, IPointLike } from '@visactor/vutils';\nimport { isObject, isString, max, merge } from '@visactor/vutils';\nimport { Generator } from '../../common/generator';\nimport {\n createGroup,\n createLine,\n createRect,\n createRichText,\n createText,\n getRichTextBounds,\n RichText\n} from '../../graphic';\nimport type {\n IGroup,\n ILine,\n IPlugin,\n IPluginService,\n IRect,\n IRichText,\n IRichTextCharacter,\n IRichTextFrame,\n IRichTextIcon,\n IRichTextLine,\n IRichTextParagraph,\n IRichTextParagraphCharacter,\n ITicker,\n ITimeline\n} from '../../interface';\nimport { Animate, DefaultTicker, DefaultTimeline } from '../../animate';\nimport { EditModule, findConfigIndexByCursorIdx, getDefaultCharacterConfig } from './edit-module';\nimport { application } from '../../application';\nimport { getWordStartEndIdx } from '../../graphic/richtext/utils';\n// import { testLetter, testLetter2 } from '../../graphic/richtext/utils';\n\ntype UpdateType =\n | 'input'\n | 'change'\n | 'onfocus'\n | 'beforeOnfocus'\n | 'defocus'\n | 'beforeDefocus'\n | 'selection'\n | 'dispatch';\n\nclass Selection {\n selectionStartCursorIdx: number;\n curCursorIdx: number;\n rt: IRichText;\n\n constructor(selectionStartCursorIdx: number, curCursorIdx: number, rt: IRichText) {\n this.curCursorIdx = curCursorIdx;\n this.selectionStartCursorIdx = selectionStartCursorIdx;\n this.rt = rt;\n }\n\n isEmpty(): boolean {\n return this.selectionStartCursorIdx === this.curCursorIdx;\n }\n\n getSelectionPureText(): string {\n const minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);\n const maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);\n if (minCursorIdx === maxCursorIdx) {\n return '';\n }\n const config = this.rt.attribute.textConfig as any;\n const startIdx = findConfigIndexByCursorIdx(config, Math.ceil(minCursorIdx));\n const endIdx = findConfigIndexByCursorIdx(config, Math.floor(maxCursorIdx));\n let str = '';\n for (let i = startIdx; i <= endIdx; i++) {\n str += config[i].text;\n }\n return str;\n }\n\n hasFormat(key: string): boolean {\n return this.getFormat(key) != null;\n }\n\n /**\n * 获取第idx中key的值\n * @param key\n * @param cursorIdx\n */\n _getFormat(key: string, cursorIdx: number) {\n if (!this.rt) {\n return null;\n }\n let idx = Math.round(cursorIdx);\n const config = this.rt.attribute.textConfig as any;\n if (!config.length) {\n return null;\n }\n for (let i = 0; i < config.length; i++) {\n if (config[i].text !== '\\n') {\n idx--;\n if (idx < 0) {\n return config[i][key];\n }\n }\n }\n return config[Math.min(idx, config.length - 1)][key] ?? (this.rt.attribute as any)[key];\n }\n getFormat(key: string): any {\n return this.getAllFormat(key)[0];\n }\n\n getAllFormat(key: string): any {\n const valSet = new Set();\n const minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx);\n const maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);\n if (minCursorIdx === maxCursorIdx) {\n return [this._getFormat(key, minCursorIdx)];\n }\n for (let i = Math.ceil(minCursorIdx); i <= Math.floor(maxCursorIdx); i++) {\n const val = this._getFormat(key, i);\n val && valSet.add(val);\n }\n return Array.from(valSet.values());\n }\n}\n\nexport const FORMAT_TEXT_COMMAND = 'FORMAT_TEXT_COMMAND';\nexport const FORMAT_ALL_TEXT_COMMAND = 'FORMAT_ALL_TEXT_COMMAND';\nexport const FORMAT_ELEMENT_COMMAND = 'FORMAT_ELEMENT_COMMAND';\nexport class RichTextEditPlugin implements IPlugin {\n name: 'RichTextEditPlugin' = 'RichTextEditPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n\n // 是否正在编辑\n editing: boolean = false;\n // 是否正在聚焦中\n focusing: boolean = false;\n // 鼠标是否按下,判断是否展示selection\n pointerDown: boolean = false;\n\n // selection组件\n editLine: ILine;\n editBg: IGroup;\n shadowPlaceHolder: IRichText;\n shadowBounds: IRect;\n\n ticker: ITicker;\n timeline: ITimeline;\n\n currRt: IRichText;\n\n // 当前的cursor信息\n // 0.1为第一个字符右侧, -0.1为第一个字符左侧\n // 1.1为第二个字符右侧,0.9为第二个字符左侧\n curCursorIdx: number;\n selectionStartCursorIdx: number;\n startCursorPos?: IPointLike;\n\n editModule: EditModule;\n\n protected commandCbs: Map<string, Array<(payload: any, p: RichTextEditPlugin) => void>>;\n protected updateCbs: Array<(type: UpdateType, p: RichTextEditPlugin, params?: any) => void>;\n\n // 富文本外部有align或者baseline的时候,需要对光标做偏移\n protected declare deltaX: number;\n protected declare deltaY: number;\n\n // static splitText(text: string) {\n // // 😁这种emoji长度算两个,所以得处理一下\n // return Array.from(text);\n // }\n\n static tryUpdateRichtext(richtext: IRichText) {\n const cache = richtext.getFrameCache();\n if (!RichText.AllSingleCharacter(cache)) {\n const tc = RichText.TransformTextConfig2SingleCharacter(richtext.attribute.textConfig);\n // richtext.attribute.textConfig.forEach((item: IRichTextParagraphCharacter) => {\n // const textList = RichTextEditPlugin.splitText(item.text.toString());\n // if (isString(item.text) && textList.length > 1) {\n // // 拆分\n // for (let i = 0; i < textList.length; i++) {\n // const t = textList[i];\n // tc.push({ ...item, text: t });\n // }\n // } else {\n // tc.push(item);\n // }\n // });\n richtext.setAttributes({ textConfig: tc });\n richtext.doUpdateFrameCache(tc);\n }\n }\n\n static CreateSelection(rt: IRichText) {\n if (!rt) {\n return null;\n }\n const { textConfig = [] } = rt.attribute;\n return new Selection(0, textConfig.length - 1, rt);\n }\n\n constructor() {\n this.commandCbs = new Map();\n this.commandCbs.set(FORMAT_TEXT_COMMAND, [this.formatTextCommandCb]);\n this.commandCbs.set(FORMAT_ALL_TEXT_COMMAND, [this.formatAllTextCommandCb]);\n this.updateCbs = [];\n this.timeline = new DefaultTimeline();\n this.ticker = new DefaultTicker([this.timeline]);\n this.deltaX = 0;\n this.deltaY = 0;\n }\n\n formatTextCommandCb = (payload: string, p: RichTextEditPlugin) => {\n const rt = p.currRt;\n if (!rt) {\n return;\n }\n const selectionData = p.getSelection();\n if (!selectionData) {\n return;\n }\n const { selectionStartCursorIdx, curCursorIdx } = selectionData;\n const minCursorIdx = Math.min(selectionStartCursorIdx, curCursorIdx);\n const maxCursorIdx = Math.max(selectionStartCursorIdx, curCursorIdx);\n const minConfigIdx = findConfigIndexByCursorIdx(rt.attribute.textConfig, minCursorIdx);\n const maxConfigIdx = findConfigIndexByCursorIdx(rt.attribute.textConfig, maxCursorIdx);\n const config = rt.attribute.textConfig.slice(minConfigIdx, maxConfigIdx);\n this._formatTextCommand(payload, config, rt);\n };\n\n formatAllTextCommandCb = (payload: string, p: RichTextEditPlugin) => {\n const rt = p.currRt;\n if (!rt) {\n return;\n }\n const config = rt.attribute.textConfig;\n this._formatTextCommand(payload, config, rt);\n };\n\n _formatTextCommand(payload: string, config: IRichTextCharacter[], rt: IRichText) {\n if (payload === 'bold') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.fontWeight = 'bold'));\n } else if (payload === 'italic') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.fontStyle = 'italic'));\n } else if (payload === 'underline') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.underline = true));\n } else if (payload === 'lineThrough') {\n config.forEach((item: IRichTextParagraphCharacter) => (item.lineThrough = true));\n } else if (isObject(payload)) {\n config.forEach((item: IRichTextParagraphCharacter) => merge(item, payload));\n }\n rt.setAttributes(rt.attribute);\n // 重新渲染Selection位置,因为fontSize会影响文字大小\n const cache = rt.getFrameCache();\n if (!cache) {\n return;\n }\n this.selectionRangeByCursorIdx(this.selectionStartCursorIdx, this.curCursorIdx, cache);\n // 设置属性的时候,Bounds也要更改\n this.tryShowInputBounds();\n }\n\n dispatchCommand(command: string, payload: any) {\n const cbs = this.commandCbs.get(command);\n cbs && cbs.forEach(cb => cb(payload, this));\n this.updateCbs.forEach(cb => cb('dispatch', this));\n }\n\n registerCommand(command: string, cb: (payload: any, p: RichTextEditPlugin) => void) {\n const cbs: Array<(payload: any, p: RichTextEditPlugin) => void> = this.commandCbs.get(command) || [];\n cbs.push(cb);\n }\n\n removeCommand(command: string, cb: (payload: any, p: RichTextEditPlugin) => void) {\n const cbs: Array<(payload: any, p: RichTextEditPlugin) => void> = this.commandCbs.get(command) || [];\n const idx = cbs.indexOf(cb);\n if (idx > -1) {\n cbs.splice(idx, 1);\n }\n }\n\n registerUpdateListener(cb: (type: UpdateType, p: RichTextEditPlugin) => void) {\n const cbs = this.updateCbs || [];\n cbs.push(cb);\n }\n\n removeUpdateListener(cb: (type: UpdateType, p: RichTextEditPlugin) => void) {\n const cbs = this.updateCbs || [];\n const idx = cbs.indexOf(cb);\n if (idx > -1) {\n cbs.splice(idx, 1);\n }\n }\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n this.editModule = new EditModule();\n // context.stage.on('click', this.handleClick);\n context.stage.on('pointermove', this.handleMove);\n context.stage.on('pointerdown', this.handlePointerDown);\n context.stage.on('pointerup', this.handlePointerUp);\n context.stage.on('pointerleave', this.handlePointerUp);\n context.stage.on('dblclick', this.handleDBLClick);\n application.global.addEventListener('keydown', this.handleKeyDown);\n\n this.editModule.onInput(this.handleInput);\n this.editModule.onChange(this.handleChange);\n this.editModule.onFocusOut(this.handleFocusOut);\n }\n\n copyToClipboard(e: KeyboardEvent): boolean {\n if (\n (application.global.isMacOS() && e.metaKey && e.key === 'c') ||\n (!application.global.isMacOS() && e.ctrlKey && e.key === 'c')\n ) {\n const selection = this.getSelection();\n const text = selection.getSelectionPureText();\n application.global.copyToClipBoard(text);\n e.preventDefault();\n return true;\n }\n return false;\n }\n\n /**\n * 选中某一个区间,startIdx和endIdx分别是开始结束的光标位置\n * 设置光标为endIdx,设置开始位置为startIdx\n * @param startIdx 开始位置\n * @param endIdx 结束位置\n * @returns\n */\n selectionRange(startIdx: number, endIdx: number) {\n const currRt = this.currRt;\n if (!currRt) {\n return;\n }\n const cache = currRt.getFrameCache();\n if (!cache) {\n return;\n }\n // 对startIdx和endIdx约束\n const { lines } = cache;\n const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;\n if (startIdx > endIdx) {\n [startIdx, endIdx] = [endIdx, startIdx];\n }\n startIdx = Math.min(Math.max(startIdx, -0.1), totalCursorCount + 0.1);\n endIdx = Math.min(Math.max(endIdx, -0.1), totalCursorCount + 0.1);\n\n this.selectionRangeByCursorIdx(startIdx, endIdx, cache);\n }\n\n selectionRangeByCursorIdx(startCursorIdx: number, endCursorIdx: number, cache: IRichTextFrame) {\n this.curCursorIdx = endCursorIdx;\n this.selectionStartCursorIdx = startCursorIdx;\n const { x, y1, y2 } = this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx, this.currRt);\n this.startCursorPos = { x, y: (y1 + y2) / 2 };\n const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);\n this._tryShowSelection(pos, cache);\n }\n\n fullSelection(e: KeyboardEvent) {\n if (\n (application.global.isMacOS() && e.metaKey && e.key === 'a') ||\n (!application.global.isMacOS() && e.ctrlKey && e.key === 'a')\n ) {\n const currRt = this.currRt;\n if (!currRt) {\n return;\n }\n const cache = currRt.getFrameCache();\n if (!cache) {\n return;\n }\n const { lines } = cache;\n if (lines.length === 0) {\n return;\n }\n if (!lines[0].paragraphs || lines[0].paragraphs.length === 0) {\n return;\n }\n const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;\n this.selectionRange(-0.1, totalCursorCount + 0.1);\n\n e.preventDefault();\n return true;\n }\n return false;\n }\n\n directKey(e: KeyboardEvent) {\n if (!(e.key === 'ArrowUp' || e.key === 'ArrowDown' || e.key === 'ArrowLeft' || e.key === 'ArrowRight')) {\n return false;\n }\n const cache = this.currRt.getFrameCache();\n if (!cache) {\n return false;\n }\n let x = 0;\n let y = 0;\n if (e.key === 'ArrowUp') {\n y = -1;\n } else if (e.key === 'ArrowDown') {\n y = 1;\n } else if (e.key === 'ArrowLeft') {\n x = -1;\n } else if (e.key === 'ArrowRight') {\n x = 1;\n }\n\n // const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n const { lineInfo, columnInfo } = this.getColumnByIndex(cache, Math.round(this.curCursorIdx));\n const { lines } = cache;\n const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;\n if (x) {\n // 快接近首尾需要特殊处理\n if (\n x > 0 &&\n columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 2] &&\n this.curCursorIdx < Math.round(this.curCursorIdx)\n ) {\n this.curCursorIdx = this.curCursorIdx + 0.2;\n } else if (\n x > 0 &&\n columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 1] &&\n this.curCursorIdx > Math.round(this.curCursorIdx)\n ) {\n this.curCursorIdx = this.curCursorIdx + 1 - 0.2;\n } else if (x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx > Math.round(this.curCursorIdx)) {\n this.curCursorIdx = this.curCursorIdx - 0.2;\n } else if (x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx < Math.round(this.curCursorIdx)) {\n this.curCursorIdx = this.curCursorIdx - 1 + 0.2;\n } else {\n this.curCursorIdx += x;\n }\n if (this.curCursorIdx < -0.1) {\n this.curCursorIdx = -0.1;\n } else if (this.curCursorIdx > totalCursorCount + 0.1) {\n this.curCursorIdx = totalCursorCount + 0.1;\n }\n\n const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt);\n this.hideSelection();\n }\n\n if (y) {\n if (y > 0 && lineInfo === cache.lines[cache.lines.length - 1]) {\n return;\n }\n if (y < 0 && lineInfo === cache.lines[0]) {\n return;\n }\n const lineIdx = cache.lines.findIndex(item => item === lineInfo) + y;\n if (lineIdx < 0 || lineIdx >= cache.lines.length) {\n return;\n }\n const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);\n const posX = pos.x;\n let posY = (pos.y1 + pos.y2) / 2;\n posY += y * lineInfo.height;\n const nextLineInfo = cache.lines[lineIdx];\n const { columnInfo, delta } = this.getColumnAndIndexByLinePoint(nextLineInfo, { x: posX, y: posY });\n if (!columnInfo) {\n return;\n }\n let cursorIdx = this.getColumnIndex(cache, columnInfo) + delta;\n const data = this.computedCursorPosByCursorIdx(cursorIdx, this.currRt);\n\n if (cursorIdx < -0.1) {\n cursorIdx = -0.1;\n } else if (cursorIdx > totalCursorCount + 0.1) {\n cursorIdx = totalCursorCount + 0.1;\n }\n\n this.curCursorIdx = cursorIdx;\n this.selectionStartCursorIdx = cursorIdx;\n this.setCursorAndTextArea(data.x, data.y1, data.y2, this.currRt);\n }\n\n return true;\n }\n\n handleKeyDown = (e: KeyboardEvent) => {\n if (!(this.currRt && this.editing)) {\n return;\n }\n // 复制到剪贴板\n // cmd/ctl + C\n if (this.copyToClipboard(e)) {\n return;\n }\n // 全选\n // cmd/ctl + A\n if (this.fullSelection(e)) {\n return;\n }\n // 方向键\n // 上、下、左、右\n if (this.directKey(e)) {\n return;\n }\n };\n\n handleInput = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => {\n if (!this.currRt) {\n return;\n }\n // 如果文字被删除光了,那么展示一个shadowRoot\n this.tryShowShadowPlaceholder();\n this.tryShowInputBounds();\n\n // 修改cursor的位置,但并不同步到curIdx,因为这可能是临时的\n // const p = this.getPointByColumnIdx(cursorIdx, rt, orient);\n // console.log(this.curCursorIdx, cursorIdx);\n this.hideSelection();\n // this.setCursor(p.x, p.y1, p.y2);\n this.updateCbs.forEach(cb => cb('input', this));\n };\n\n handleChange = (text: string, isComposing: boolean, cursorIdx: number, rt: IRichText) => {\n if (!this.currRt) {\n return;\n }\n this.tryShowShadowPlaceholder();\n this.tryShowInputBounds();\n\n // 修改cursor的位置,并同步到editModule\n this.curCursorIdx = cursorIdx;\n this.selectionStartCursorIdx = cursorIdx;\n const p = this.computedCursorPosByCursorIdx(cursorIdx, rt);\n this.setCursorAndTextArea(p.x, p.y1, p.y2, rt);\n this.hideSelection();\n this.updateCbs.forEach(cb => cb('change', this));\n };\n\n tryShowShadowPlaceholder() {\n if (!this.currRt) {\n return;\n }\n // 删除富文本影子节点\n const shadowRoot = this.currRt.shadowRoot;\n if (shadowRoot) {\n const placeholder = shadowRoot.getElementsByType('richtext')[0];\n placeholder && shadowRoot.removeChild(placeholder);\n }\n const { textConfig, editOptions } = this.currRt.attribute;\n if (textConfig && textConfig.length) {\n return;\n }\n if (!(editOptions && editOptions.placeholder)) {\n return;\n }\n const {\n placeholder,\n placeholderColor = 'rgba(0, 0, 0, 0.6)',\n placeholderFontFamily,\n placeholderFontSize\n } = editOptions;\n const shadow = this.getShadow(this.currRt);\n const textConfigItem = { ...getDefaultCharacterConfig(this.currRt.attribute), text: placeholder };\n if (placeholderColor) {\n textConfigItem.fill = placeholderColor;\n }\n if (placeholderFontFamily) {\n textConfigItem.fontFamily = placeholderFontFamily;\n }\n if (placeholderFontSize) {\n textConfigItem.fontSize = placeholderFontSize;\n }\n\n this.shadowPlaceHolder = createRichText({\n ...this.currRt.attribute,\n x: 0,\n y: 0,\n pickable: false,\n editable: false,\n editOptions: null,\n angle: 0,\n _debug_bounds: false,\n textConfig: [textConfigItem]\n });\n shadow.add(this.shadowPlaceHolder);\n }\n\n tryShowInputBounds() {\n if (!(this.currRt && this.focusing)) {\n return;\n }\n const { editOptions = {} } = this.currRt.attribute;\n const { boundsStrokeWhenInput } = editOptions;\n\n if (!editOptions || !boundsStrokeWhenInput) {\n return;\n }\n const { attribute } = this.currRt;\n let b = this.currRt.AABBBounds;\n let h = b.height();\n if (!attribute.textConfig.length && this.editLine) {\n const { points } = this.editLine.attribute;\n h = points[1].y - points[0].y;\n b = getRichTextBounds({ ...this.shadowPlaceHolder.attribute });\n }\n this.shadowBounds = this.shadowBounds || createRect({});\n this.shadowBounds.setAttributes({\n x: 0,\n y: 0,\n width: b.width(),\n height: h,\n fill: false,\n stroke: boundsStrokeWhenInput,\n lineWidth: 1,\n zIndex: -1\n });\n const shadow = this.getShadow(this.currRt);\n shadow.add(this.shadowBounds);\n\n this.offsetLineBgAndShadowBounds();\n }\n\n trySyncPlaceholderToTextConfig() {\n if (!this.currRt) {\n return;\n }\n const { textConfig, editOptions } = this.currRt.attribute;\n if (textConfig && textConfig.length) {\n return;\n }\n if (!(editOptions && editOptions.placeholder && editOptions.syncPlaceHolderToTextConfig)) {\n return;\n }\n const { placeholder } = editOptions;\n this.currRt.setAttributes({\n textConfig: [\n {\n text: placeholder,\n ...getDefaultCharacterConfig(this.currRt.attribute)\n }\n ]\n });\n }\n\n handleFocusIn = () => {\n throw new Error('不会走到这里 handleFocusIn');\n // this.updateCbs.forEach(cb => cb(this.editing ? 'onfocus' : 'defocus', this));\n };\n\n handleFocusOut = () => {\n throw new Error('不会走到这里 handleFocusOut');\n // console.log('abc')\n // this.editing = false;\n // this.deFocus();\n // this.pointerDown = false;\n // this.triggerRender();\n // this.updateCbs.forEach(cb => cb('defocus', this));\n };\n\n deactivate(context: IPluginService): void {\n // context.stage.off('pointerdown', this.handleClick);\n context.stage.off('pointermove', this.handleMove);\n context.stage.off('pointerdown', this.handlePointerDown);\n context.stage.off('pointerup', this.handlePointerUp);\n context.stage.off('pointerleave', this.handlePointerUp);\n context.stage.off('dblclick', this.handleDBLClick);\n\n application.global.addEventListener('keydown', this.handleKeyDown);\n }\n\n handleMove = (e: PointerEvent) => {\n // 如果发现当前的richtext不是editable的richtext,那么需要强行defocus一下,这可能是用户手动设置了richtext的editable为false\n if (this.currRt && !this.currRt.attribute.editable) {\n this.deFocus(true);\n }\n if (!this.isEditableRichtext(e)) {\n this.handleLeave();\n return;\n }\n // this.currRt = e.target as IRichText;\n this.handleEnter();\n // TODO 这里可能走不到\n (e.target as any).once('pointerleave', this.handleLeave);\n\n this.tryShowSelection(e, false);\n };\n\n // 鼠标进入\n handleEnter = () => {\n this.editing = true;\n this.pluginService.stage.setCursor('text');\n };\n\n // 鼠标离开\n handleLeave = () => {\n this.editing = false;\n this.pluginService.stage.setCursor('default');\n };\n\n handlePointerDown = (e: PointerEvent) => {\n if (!this.editing || !this.isEditableRichtext(e)) {\n this.deFocus(true);\n } else {\n this.onFocus(e);\n }\n this.triggerRender();\n this.pointerDown = true;\n this.updateCbs.forEach(cb => cb(this.editing ? 'onfocus' : 'defocus', this));\n };\n handlePointerUp = (e: PointerEvent) => {\n this.pointerDown = false;\n };\n handleDBLClick = (e: PointerEvent) => {\n if (!this.editing) {\n return;\n }\n\n this.tryShowSelection(e, true);\n };\n\n onFocus(e: PointerEvent, data?: any) {\n this.updateCbs && this.updateCbs.forEach(cb => cb('beforeOnfocus', this));\n this.deFocus(false);\n this.focusing = true;\n const target = e.target as IRichText;\n if (!(target && target.type === 'richtext')) {\n return;\n }\n this.currRt = target as IRichText;\n\n // 创建shadowGraphic\n\n RichTextEditPlugin.tryUpdateRichtext(target);\n const shadowRoot = this.getShadow(target);\n const cache = target.getFrameCache();\n if (!cache) {\n return;\n }\n // 计算全局偏移\n this.computeGlobalDelta(cache);\n\n // 添加cursor节点,shadowRoot在上面\n shadowRoot.setAttributes({ shadowRootIdx: 1, pickable: false, x: this.deltaX, y: this.deltaY });\n if (!this.editLine) {\n const line = createLine({ x: 0, y: 0, lineWidth: 1, stroke: 'black' });\n // 不使用stage的Ticker,避免影响其他的动画以及受到其他动画影响\n this.addAnimateToLine(line);\n this.editLine = line;\n this.ticker.start(true);\n\n const g = createGroup({ x: 0, y: 0, width: 0, height: 0 });\n this.editBg = g;\n shadowRoot.add(this.editLine);\n shadowRoot.add(this.editBg);\n }\n\n data = data || this.computedCursorPosByEvent(e, cache);\n\n if (data) {\n const { x, y1, y2, cursorIndex } = data;\n this.startCursorPos = { x, y: (y1 + y2) / 2 };\n this.curCursorIdx = cursorIndex;\n this.selectionStartCursorIdx = cursorIndex;\n this.setCursorAndTextArea(x, y1, y2, target);\n } else {\n const x = 0;\n const y1 = 0;\n const y2 = getRichTextBounds({ ...target.attribute, textConfig: [{ text: 'a' }] }).height();\n this.startCursorPos = { x, y: (y1 + y2) / 2 };\n this.curCursorIdx = -0.1;\n this.selectionStartCursorIdx = -0.1;\n this.setCursorAndTextArea(x, y1, y2, target);\n }\n\n // 聚焦的时候也判断,这样在最开始就能展示placeholder,否则需要等用户输入\n this.tryShowShadowPlaceholder();\n // 聚焦的时候也判断,这样在最开始就能展示bounds,否则需要等用户输入\n this.tryShowInputBounds();\n // 触发Bounds更新\n this.currRt.addUpdateBoundTag();\n }\n\n // 偏移线和背景,因为文字的baseline可能是middle或者bottom\n protected offsetLineBgAndShadowBounds() {\n const rt = this.currRt;\n const { textBaseline } = rt.attribute;\n let dy = 0;\n let attr = rt.attribute;\n let b: IAABBBounds;\n if (textBaseline === 'middle' || textBaseline === 'bottom') {\n if (!attr.textConfig.length) {\n attr = { ...attr, textConfig: [{ text: 'a' }] };\n }\n b = getRichTextBounds(attr);\n }\n if (textBaseline === 'middle') {\n dy = -b.height() / 2;\n } else if (textBaseline === 'bottom') {\n dy = -b.height();\n }\n this.editLine && this.editLine.setAttributes({ dy });\n this.editBg && this.editBg.setAttributes({ dy });\n if (this.shadowBounds) {\n this.shadowBounds.setAttributes({ dy });\n }\n }\n\n protected deFocus(trulyDeFocus = false) {\n const currRt = this.currRt as IRichText;\n if (!currRt) {\n return;\n }\n this.updateCbs && this.updateCbs.forEach(cb => cb('beforeDefocus', this, { trulyDeFocus }));\n if (trulyDeFocus) {\n this.trySyncPlaceholderToTextConfig();\n currRt.detachShadow();\n }\n this.currRt = null;\n if (this.editLine) {\n this.editLine.parent && this.editLine.parent.removeChild(this.editLine);\n this.editLine.release();\n this.editLine = null;\n\n this.editBg.parent && this.editBg.parent.removeChild(this.editBg);\n this.editBg.release();\n this.editBg = null;\n }\n\n if (trulyDeFocus) {\n if (this.shadowBounds) {\n this.shadowBounds.parent && this.shadowBounds.parent.removeChild(this.shadowBounds);\n this.shadowBounds.release();\n this.shadowBounds = null;\n }\n if (this.shadowPlaceHolder) {\n this.shadowPlaceHolder.parent && this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder);\n this.shadowPlaceHolder.release();\n this.shadowPlaceHolder = null;\n }\n }\n this.focusing = false;\n\n // 清理textConfig,不让最后有换行符\n const textConfig = currRt.attribute.textConfig;\n let lastConfig = textConfig[textConfig.length - 1];\n let cleared = false;\n while (lastConfig && (lastConfig as any).text === '\\n') {\n textConfig.pop();\n lastConfig = textConfig[textConfig.length - 1];\n cleared = true;\n }\n cleared && currRt.setAttributes({ textConfig });\n\n // TODO 因为handlerLeave可能不会执行,所以这里需要手动清除\n currRt.removeEventListener('pointerleave', this.handleLeave);\n }\n\n protected addAnimateToLine(line: ILine) {\n line.animates &&\n line.animates.forEach(animate => {\n animate.stop();\n animate.release();\n });\n const animate = line.animate({\n timeline: this.timeline\n });\n animate.to({ opacity: 1 }, 10, 'linear').wait(700).to({ opacity: 0 }, 10, 'linear').wait(700).loop(Infinity);\n }\n\n // 显示selection\n tryShowSelection(e: PointerEvent, dblclick: boolean) {\n const cache = (e.target as IRichText).getFrameCache();\n if (!(cache && this.editBg && this.startCursorPos)) {\n return;\n }\n\n if (!dblclick) {\n if (this.pointerDown) {\n const currCursorData = this.computedCursorPosByEvent(e, cache);\n if (!currCursorData) {\n return;\n }\n this.curCursorIdx = currCursorData.cursorIndex;\n this._tryShowSelection(currCursorData, cache);\n }\n } else {\n const currCursorData = this.computedCursorPosByEvent(e, cache);\n if (!currCursorData) {\n return;\n }\n // const curCursorIdx = currCursorData.cursorIndex;\n const lineInfo = currCursorData.lineInfo;\n const columnIndex = lineInfo.paragraphs.findIndex(item => item === currCursorData.columnInfo);\n if (columnIndex < 0) {\n return;\n }\n const str = lineInfo.paragraphs.reduce((str, item) => {\n return str + item.text;\n }, '');\n\n let idx = 0;\n for (let i = 0; i < cache.lines.length; i++) {\n const line = cache.lines[i];\n if (line === lineInfo) {\n break;\n }\n idx += line.paragraphs.length;\n }\n\n const { startIdx, endIdx } = getWordStartEndIdx(str, columnIndex);\n\n this.selectionRange(idx + startIdx - 0.1, idx + endIdx - 0.1);\n }\n }\n\n _tryShowSelection(\n currCursorData: {\n x: any;\n y1: number;\n y2: number;\n },\n cache: IRichTextFrame\n ) {\n let startCursorPos = this.startCursorPos;\n let endCursorPos = {\n x: currCursorData.x,\n y: (currCursorData.y1 + currCursorData.y2) / 2\n };\n let line0Info = this.getLineByPoint(cache, startCursorPos);\n let line1Info = this.getLineByPoint(cache, endCursorPos);\n if (!line0Info || !line1Info) {\n return;\n }\n\n if (\n startCursorPos.y > endCursorPos.y ||\n (startCursorPos.y === endCursorPos.y && startCursorPos.x > endCursorPos.x)\n ) {\n [startCursorPos, endCursorPos] = [endCursorPos, startCursorPos];\n [line1Info, line0Info] = [line0Info, line1Info];\n }\n\n this.hideSelection();\n if (line0Info === line1Info) {\n // 同行\n this.editBg.setAttributes({\n x: startCursorPos.x,\n y: line0Info.top,\n width: endCursorPos.x - startCursorPos.x,\n height: line0Info.height,\n fill: '#336df4',\n fillOpacity: 0.2\n });\n } else {\n this.editBg.setAttributes({ x: 0, y: line0Info.top, width: 0, height: 0 });\n const startIdx = cache.lines.findIndex(item => item === line0Info);\n const endIdx = cache.lines.findIndex(item => item === line1Info);\n let y = 0;\n for (let i = startIdx; i <= endIdx; i++) {\n const line = cache.lines[i];\n if (i === startIdx) {\n const p = line.paragraphs[line.paragraphs.length - 1];\n this.editBg.add(\n createRect({\n x: startCursorPos.x,\n y,\n width: p.left + p.width - startCursorPos.x,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n } else if (i === endIdx) {\n const p = line.paragraphs[0];\n this.editBg.add(\n createRect({\n x: p.left,\n y,\n width: endCursorPos.x - p.left,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n } else {\n const p0 = line.paragraphs[0];\n const p1 = line.paragraphs[line.paragraphs.length - 1];\n this.editBg.add(\n createRect({\n x: p0.left,\n y,\n width: p1.left + p1.width - p0.left,\n height: line.height,\n fill: '#336df4',\n fillOpacity: 0.2\n })\n );\n }\n y += line.height;\n }\n }\n\n this.setCursorAndTextArea(currCursorData.x, currCursorData.y1, currCursorData.y2, this.currRt as IRichText);\n\n this.triggerRender();\n this.updateCbs.forEach(cb => cb('selection', this));\n }\n\n hideSelection() {\n if (this.editBg) {\n this.editBg.removeAllChild();\n this.editBg.setAttributes({ fill: 'transparent' });\n }\n }\n\n protected getShadow(rt: IRichText) {\n const sr = rt.shadowRoot || rt.attachShadow();\n sr.setAttributes({ boundsMode: 'empty' });\n return sr;\n }\n\n protected getLineByPoint(cache: IRichTextFrame, p1: IPointLike): IRichTextLine {\n let lineInfo = cache.lines[0];\n for (let i = 0; i < cache.lines.length; i++) {\n if (lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y) {\n break;\n }\n lineInfo = cache.lines[i + 1];\n }\n\n return lineInfo;\n }\n protected getColumnAndIndexByLinePoint(\n lineInfo: IRichTextLine,\n p1: IPointLike\n ): {\n columnInfo: IRichTextParagraph | IRichTextIcon;\n delta: number;\n } {\n let columnInfo = lineInfo.paragraphs[0];\n let delta = 0;\n if (lineInfo.paragraphs.length) {\n const start = lineInfo.paragraphs[0];\n const end = lineInfo.paragraphs[lineInfo.paragraphs.length - 1];\n if (p1.x <= start.left) {\n delta = -0.1;\n columnInfo = start;\n } else if (p1.x >= end.left + end.width) {\n delta = 0.1;\n columnInfo = end;\n }\n }\n\n if (!delta) {\n for (let i = 0; i < lineInfo.paragraphs.length; i++) {\n columnInfo = lineInfo.paragraphs[i];\n if (columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x) {\n if (p1.x > columnInfo.left + columnInfo.width / 2) {\n delta = 0.1;\n } else {\n delta = -0.1;\n }\n break;\n }\n }\n }\n\n return {\n columnInfo,\n delta\n };\n }\n /* 工具函数 */\n /**\n * 根据给定的ParagraphInfo得到对应的index\n * @param cache 富文本缓存\n * @param cInfo ParagraphInfo\n * @returns\n */\n protected getColumnIndex(cache: IRichTextFrame, cInfo: IRichTextParagraph | IRichTextIcon) {\n // TODO 【注意】认为cache都是单个字符拆分的\n let inputIndex = -1;\n for (let i = 0; i < cache.lines.length; i++) {\n const line = cache.lines[i];\n for (let j = 0; j < line.paragraphs.length; j++) {\n inputIndex++;\n if (cInfo === line.paragraphs[j]) {\n return inputIndex;\n }\n }\n }\n return -1;\n }\n\n protected isRichtext(e: PointerEvent) {\n return !!(e.target && (e.target as any).type === 'richtext');\n }\n\n protected isEditableRichtext(e: PointerEvent) {\n return this.isRichtext(e) && !!(e.target as any).attribute.editable;\n }\n\n // 如果没有开自动渲染,得触发重绘\n protected triggerRender() {\n this.pluginService.stage.renderNextFrame();\n }\n\n protected computeGlobalDelta(cache: IRichTextFrame) {\n this.deltaX = 0;\n this.deltaY = 0;\n const height = cache.height;\n const actualHeight = cache.actualHeight;\n const width = cache.lines.reduce((w, item) => Math.max(w, item.actualWidth), 0);\n if (cache.globalAlign === 'center') {\n this.deltaX = -width / 2;\n } else if (cache.globalAlign === 'right') {\n this.deltaX = -width;\n }\n if (cache.verticalDirection === 'middle') {\n this.deltaY = height / 2 - actualHeight / 2;\n } else if (cache.verticalDirection === 'bottom') {\n this.deltaY = height - actualHeight;\n }\n }\n\n protected getEventPosition(e: PointerEvent): IPointLike {\n const p = this.pluginService.stage.eventPointTransform(e);\n\n const p1 = { x: 0, y: 0 };\n (e.target as IRichText).globalTransMatrix.transformPoint(p, p1);\n p1.x -= this.deltaX;\n p1.y -= this.deltaY;\n\n const rt = this.currRt;\n const { textBaseline } = rt.attribute;\n let dy = 0;\n if (textBaseline === 'middle') {\n const b = getRichTextBounds(rt.attribute);\n dy = b.height() / 2;\n } else if (textBaseline === 'bottom') {\n const b = getRichTextBounds(rt.attribute);\n dy = b.height();\n }\n p1.y += dy;\n return p1;\n }\n\n protected setCursorAndTextArea(x: number, y1: number, y2: number, rt: IRichText) {\n this.editLine.setAttributes({\n points: [\n { x, y: y1 },\n { x, y: y2 }\n ]\n });\n this.addAnimateToLine(this.editLine);\n const out = { x: 0, y: 0 };\n rt.globalTransMatrix.getInverse().transformPoint({ x, y: y1 }, out);\n // TODO 考虑stage变换\n const { left, top } = this.pluginService.stage.window.getBoundingClientRect();\n out.x += left;\n out.y += top;\n\n this.offsetLineBgAndShadowBounds();\n\n this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);\n }\n\n /**\n * 根据Event算出光标位置等信息\n * @param e Event\n * @param cache 富文本缓存\n * @returns\n */\n protected computedCursorPosByEvent(e: PointerEvent, cache: IRichTextFrame) {\n const p1 = this.getEventPosition(e);\n const lineInfo = this.getLineByPoint(cache, p1);\n if (!lineInfo) {\n return;\n }\n\n const { columnInfo, delta } = this.getColumnAndIndexByLinePoint(lineInfo, p1);\n if (!columnInfo) {\n return;\n }\n\n const y1 = lineInfo.top;\n const y2 = lineInfo.top + lineInfo.height;\n\n let cursorIndex = this.getColumnIndex(cache, columnInfo);\n cursorIndex += delta;\n const x = columnInfo.left + (delta > 0 ? columnInfo.width : 0);\n\n return {\n x,\n y1,\n y2,\n cursorIndex,\n lineInfo,\n columnInfo\n };\n }\n\n /**\n * 根据cursorIdx计算出点的位置\n * @param cursorIdx index\n * @param rt 富文本\n * @returns\n */\n protected computedCursorPosByCursorIdx(cursorIdx: number, rt: IRichText) {\n const idx = Math.round(cursorIdx);\n const leftRight = cursorIdx - idx; // >0 向右,<0 向左\n const cache = rt.getFrameCache();\n const column = this.getColumnByIndex(cache, idx);\n const height = rt.attribute.fontSize ?? (rt.attribute.textConfig?.[0] as any)?.fontSize;\n if (!column) {\n // 检查是不是空文本\n if (!cache.lines.length) {\n const b = getRichTextBounds({ ...rt.attribute, textConfig: [{ text: 'a' }] });\n return {\n x: 0,\n y1: 0,\n y2: b.height()\n };\n }\n return {\n x: 0,\n y1: 0,\n y2: height\n };\n }\n const { lineInfo, columnInfo } = column;\n const y1 = lineInfo.top;\n const y2 = lineInfo.top + lineInfo.height;\n const x = columnInfo.left + (leftRight < 0 ? 0 : columnInfo.width);\n\n return { x, y1, y2, lineInfo, columnInfo };\n }\n\n /**\n * 根据index获取columnInfo\n * @param cache 缓存\n * @param index index\n * @returns\n */\n protected getColumnByIndex(\n cache: IRichTextFrame,\n index: number\n ): {\n lineInfo: IRichTextLine;\n columnInfo: IRichTextParagraph | IRichTextIcon;\n } | null {\n // TODO 认为都是单个字符拆分的\n for (let i = 0, inputIndex = 0; i < cache.lines.length; i++) {\n const lineInfo = cache.lines[i];\n for (let j = 0; j < lineInfo.paragraphs.length; j++) {\n const columnInfo = lineInfo.paragraphs[j];\n if (inputIndex === index) {\n return {\n lineInfo,\n columnInfo\n };\n }\n inputIndex++;\n }\n }\n return null;\n }\n\n release() {\n this.deactivate(this.pluginService);\n this.editModule.release();\n }\n\n /**\n * 获取当前选择的区间范围\n * @param defaultAll 如果force为true,又没有选择,则认为选择了所有然后进行匹配,如果为false,则认为什么都没有选择,返回null\n * @returns\n */\n getSelection(defaultAll: boolean = false) {\n if (!this.currRt) {\n return null;\n }\n if (\n this.selectionStartCursorIdx != null &&\n this.curCursorIdx != null\n // this.selectionStartCursorIdx !== this.curCursorIdx &&\n ) {\n return new Selection(this.selectionStartCursorIdx, this.curCursorIdx, this.currRt);\n } else if (defaultAll) {\n return RichTextEditPlugin.CreateSelection(this.currRt);\n }\n return null;\n }\n\n forceFocus(params: { e?: PointerEvent; target: IRichText | null; cursorIndex?: number }) {\n const { target, e, cursorIndex } = params;\n if (!target) {\n return;\n }\n this.currRt = target;\n if (e) {\n this._forceFocusByEvent(e);\n } else {\n this._forceFocusByCursorIndex(cursorIndex ?? -0.1);\n }\n }\n\n protected _forceFocusByEvent(e: PointerEvent) {\n this.handleEnter();\n this.handlePointerDown(e);\n this.handlePointerUp(e);\n }\n\n protected _forceFocusByCursorIndex(cursorIndex: number) {\n const richtext = this.currRt;\n if (!richtext) {\n return;\n }\n\n let x = 0;\n let y1 = 0;\n let y2 = 2;\n let lineInfo = null;\n let columnInfo = null;\n const data = this.computedCursorPosByCursorIdx(cursorIndex, richtext);\n x = data.x;\n y1 = data.y1;\n y2 = data.y2;\n lineInfo = data.lineInfo;\n columnInfo = data.columnInfo;\n\n this.onFocus({ target: this.currRt } as any, {\n x,\n y1,\n y2,\n cursorIndex,\n lineInfo,\n columnInfo\n });\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ export declare class DefaultImageRenderContribution extends DefaultRectRenderCon
|
|
|
6
6
|
time: BaseRenderContributionTime;
|
|
7
7
|
useStyle: boolean;
|
|
8
8
|
order: number;
|
|
9
|
-
drawShape(
|
|
9
|
+
drawShape(rect: any, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, rectAttribute: any, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
|
|
10
10
|
}
|
|
11
11
|
export declare const defaultImageRenderContribution: DefaultImageRenderContribution;
|
|
12
12
|
export declare const defaultImageBackgroundRenderContribution: DefaultBaseBackgroundRenderContribution;
|
|
@@ -11,8 +11,8 @@ class DefaultImageRenderContribution extends rect_contribution_render_1.DefaultR
|
|
|
11
11
|
super(...arguments), this.time = enums_1.BaseRenderContributionTime.afterFillStroke,
|
|
12
12
|
this.useStyle = !0, this.order = 0;
|
|
13
13
|
}
|
|
14
|
-
drawShape(
|
|
15
|
-
return super.drawShape(
|
|
14
|
+
drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
15
|
+
return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.ts"],"names":[],"mappings":";;;AAYA,yEAGoC;AACpC,oDAAsE;AAItE,yEAA2E;AA+H3E,MAAa,8BAA+B,SAAQ,wDAA6B;IAAjF;;QACE,SAAI,GAA+B,kCAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IAsCpB,CAAC;IArCC,SAAS,CACP,
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/contributions/image-contribution-render.ts"],"names":[],"mappings":";;;AAYA,yEAGoC;AACpC,oDAAsE;AAItE,yEAA2E;AA+H3E,MAAa,8BAA+B,SAAQ,wDAA6B;IAAjF;;QACE,SAAI,GAA+B,kCAA0B,CAAC,eAAe,CAAC;QAC9E,aAAQ,GAAY,IAAI,CAAC;QACzB,UAAK,GAAW,CAAC,CAAC;IAsCpB,CAAC;IArCC,SAAS,CACP,IAAS,EACT,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,aAAkB,EAClB,WAAyB,EACzB,MAIY,EACZ,QAIY;QAEZ,OAAO,KAAK,CAAC,SAAS,CACpB,IAAI,EACJ,OAAO,EACP,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;CACF;AAzCD,wEAyCC;AAEY,QAAA,8BAA8B,GAAG,IAAI,8BAA8B,EAAE,CAAC;AACtE,QAAA,wCAAwC,GAAG,kEAAuC,CAAC","file":"image-contribution-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IImage,\n IThemeAttribute,\n IImageRenderContribution,\n IDrawContext,\n IBackgroundConfig,\n IGraphic,\n IMarkAttribute\n} from '../../../../interface';\nimport { getTheme } from '../../../../graphic/theme';\nimport {\n defaultBaseBackgroundRenderContribution,\n DefaultBaseBackgroundRenderContribution\n} from './base-contribution-render';\nimport { BaseRenderContributionTime } from '../../../../common/enums';\nimport { isNumber, isObject } from '@visactor/vutils';\nimport { parsePadding } from '../../../../common/utils';\nimport { createRectPath } from '../../../../common/shape/rect';\nimport { DefaultRectRenderContribution } from './rect-contribution-render';\n\n// export class DefaultImageBackgroundRenderContribution\n// extends DefaultBaseBackgroundRenderContribution\n// implements IImageRenderContribution\n// {\n// time: BaseRenderContributionTime = BaseRenderContributionTime.beforeFillStroke;\n\n// drawShape(\n// graphic: IImage,\n// context: IContext2d,\n// x: number,\n// y: number,\n// doFill: boolean,\n// doStroke: boolean,\n// fVisible: boolean,\n// sVisible: boolean,\n// graphicAttribute: Required<IGraphicAttribute>,\n// drawContext: IDrawContext,\n// fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n// strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean\n// ) {\n// const {\n// background,\n// backgroundMode = graphicAttribute.backgroundMode,\n// backgroundFit = graphicAttribute.backgroundFit,\n// width,\n// height\n// } = graphic.attribute;\n// if (!background) {\n// return;\n// }\n\n// if (!graphic.backgroundImg) {\n// if (isObject(background)) {\n// const {\n// stroke,\n// fill,\n// lineWidth = 1,\n// cornerRadius = 0,\n// expandX = 0,\n// expandY = 0\n// } = background as IBackgroundConfig;\n\n// if (!stroke && !fill) {\n// return;\n// }\n\n// context.beginPath();\n// const { x, y, width, height } = getActualPosition(graphic);\n// if (cornerRadius) {\n// createRectPath(context, x - expandX, y - expandY, width + expandX * 2, height + expandY * 2, cornerRadius);\n// } else {\n// context.rect(x - expandX, y - expandY, width + expandX * 2, height + expandY * 2);\n// }\n\n// context.globalAlpha = 1;\n// if (fill) {\n// context.fillStyle = fill as string;\n// context.fill();\n// }\n\n// if (stroke && lineWidth > 0) {\n// context.lineWidth = lineWidth;\n// context.strokeStyle = stroke as string;\n// context.stroke();\n// }\n// } else {\n// context.beginPath();\n// // const b = graphic.AABBBounds;\n// // image的背景不包括Bounds了\n// context.rect(x, y, width || 0, height || 0);\n// context.fillStyle = background as string;\n// context.globalAlpha = 1;\n// context.fill();\n// }\n// } else {\n// const res = graphic.resources.get(background as any);\n// if (res.state !== 'success' || !res.data) {\n// return;\n// }\n// context.save();\n// if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {\n// const groupAttribute = getTheme(graphic.parent).group;\n// const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;\n// context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);\n// context.translate(scrollX, scrollY);\n// }\n// // context.clip();\n// const b = graphic.AABBBounds;\n// this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);\n// context.restore();\n// if (!graphic.transMatrix.onlyTranslate()) {\n// context.setTransformForCurrent();\n// }\n// }\n// }\n// }\n\n// function getActualPosition(graphic: IGraphic) {\n// const boundsPadding = parsePadding(graphic.attribute.boundsPadding);\n// const bounds = graphic.AABBBounds;\n// let x = bounds.x1;\n// let y = bounds.y1;\n// let width = bounds.width();\n// let height = bounds.height();\n\n// if (isNumber(boundsPadding)) {\n// x += boundsPadding;\n// y += boundsPadding;\n// width -= boundsPadding * 2;\n// height -= boundsPadding * 2;\n// } else {\n// x += boundsPadding[3];\n// y += boundsPadding[0];\n// width -= boundsPadding[1] + boundsPadding[3];\n// height -= boundsPadding[0] + boundsPadding[2];\n// }\n\n// return {\n// x,\n// y,\n// width,\n// height\n// };\n// }\n\nexport class DefaultImageRenderContribution extends DefaultRectRenderContribution implements IImageRenderContribution {\n time: BaseRenderContributionTime = BaseRenderContributionTime.afterFillStroke;\n useStyle: boolean = true;\n order: number = 0;\n drawShape(\n rect: any,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n rectAttribute: any,\n drawContext: IDrawContext,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n return super.drawShape(\n rect,\n context,\n x,\n y,\n doFill,\n doStroke,\n fVisible,\n sVisible,\n rectAttribute,\n drawContext,\n fillCb,\n strokeCb\n );\n }\n}\n\nexport const defaultImageRenderContribution = new DefaultImageRenderContribution();\nexport const defaultImageBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;\n"]}
|
|
@@ -82,7 +82,7 @@ let DefaultDrawContribution = class {
|
|
|
82
82
|
if (drawContext.break || !1 === group.attribute.visibleAll) return;
|
|
83
83
|
if (group.incremental && (null == drawContext.startAtId || drawContext.startAtId === group._uid)) return drawContext.break = !0,
|
|
84
84
|
void this._increaseRender(group, drawContext);
|
|
85
|
-
if (this.useDirtyBounds && !(0, vutils_1.isRectIntersect)(group.AABBBounds, this.dirtyBounds, !1)) return;
|
|
85
|
+
if (this.useDirtyBounds && !(0, vutils_1.isRectIntersect)(group.AABBBounds, this.dirtyBounds, !1) && "empty" !== group.attribute.boundsMode) return;
|
|
86
86
|
let tempBounds, nextM = parentMatrix;
|
|
87
87
|
if (this.useDirtyBounds) {
|
|
88
88
|
tempBounds = bounds_allocate_1.boundsAllocate.allocateByObj(this.dirtyBounds);
|
|
@@ -157,7 +157,8 @@ let DefaultDrawContribution = class {
|
|
|
157
157
|
this.scrollMatrix.translate(-scrollX, -scrollY));
|
|
158
158
|
}
|
|
159
159
|
if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),
|
|
160
|
-
this.useDirtyBounds && !graphic.isContainer &&
|
|
160
|
+
this.useDirtyBounds && !graphic.isContainer && "empty" !== graphic.attribute.boundsMode && !(0,
|
|
161
|
+
vutils_1.isRectIntersect)(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
|
|
161
162
|
if (retrans && graphic.parent) {
|
|
162
163
|
const {scrollX: scrollX = 0, scrollY: scrollY = 0} = graphic.parent.attribute;
|
|
163
164
|
this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAAqF;AACrF,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAA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AAa,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAChD,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,IAAA,0BAAW,EAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AAxaY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CAwanC;AAxaY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n this.init();\n }\n\n init() {\n this.contributions.forEach(item => {\n if (item.style) {\n const map = this.styleRenderMap.get(item.style) || new Map();\n map.set(item.numberType, item);\n this.styleRenderMap.set(item.style, map);\n } else {\n this.defaultRenderMap.set(item.numberType, item);\n }\n });\n this.InterceptorContributions = this.drawItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n prepareForDraw(renderService: IRenderService, drawContext: IDrawContext) {\n // 有dirtyBounds用dirtyBounds\n if (drawContext.updateBounds) {\n this.useDirtyBounds = true;\n } else {\n // 没有的话,看看是否需要跳过outRange的渲染\n this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;\n }\n }\n\n draw(renderService: IRenderService, drawContext: IDrawContext): MaybePromise<void> {\n this.prepareForDraw(renderService, drawContext);\n drawContext.drawContribution = this;\n this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap;\n // this.startAtId = drawParams.startAtId;\n this.currentRenderService = renderService;\n // this.drawParams = drawParams;\n const { context, stage, viewBox, transMatrix } = drawContext;\n\n if (!context) {\n return;\n }\n // if (context.drawPromise) {\n // return;\n // }\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());\n if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {\n const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);\n dirtyBounds.x1 = Math.floor(b.x1);\n dirtyBounds.y1 = Math.floor(b.y1);\n dirtyBounds.x2 = Math.ceil(b.x2);\n dirtyBounds.y2 = Math.ceil(b.y2);\n }\n // 如果dpr不是整数或者.5的小数,需要格式化dirtyBounds\n const d = context.dpr % 1;\n if (d || d !== 0.5) {\n dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;\n dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;\n dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;\n dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;\n }\n this.backupDirtyBounds.copy(dirtyBounds);\n context.inuse = true;\n context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n // 初始化context\n context.clearMatrix();\n context.setTransformForCurrent(true);\n\n // const drawInArea =\n // dirtyBounds.width() * context.dpr < context.canvas.width ||\n // dirtyBounds.height() * context.dpr < context.canvas.height;\n // context.save();\n\n // 设置translate\n context.translate(viewBox.x1, viewBox.y1, true);\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n\n // 如果存在3d视角,那么不使用dirtyBounds\n if (stage.camera) {\n this.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n this.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n }\n\n this.clearScreen(renderService, context, drawContext);\n // // 渲染的时候图元的起始位置就是x,y\n // this.backupDirtyBounds.translate(-x, -y);\n // this.dirtyBounds.translate(-x, -y);\n\n // // 设置translate\n // context.translate(x, y, true);\n\n context.save();\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n group.isContainer\n ? this.renderGroup(group as IGroup, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0))\n : this.renderItem(group as IGraphic, drawContext);\n });\n\n // context.restore();\n context.restore();\n context.setClearMatrix(1, 0, 0, 1, 0, 0);\n // this.break = false;\n context.inuse = false;\n context.draw();\n }\n\n doRegister() {\n throw new Error('暂不支持');\n }\n\n // 找到下一个graphic\n protected _findNextGraphic(group: IGroup): IGraphic | null {\n let parent = group.parent;\n let id = group._uid;\n while (parent) {\n const g = findNextGraphic(parent, id, DefaultAttribute.zIndex);\n if (g) {\n return g;\n }\n id = parent._uid;\n parent = parent.parent;\n }\n return null;\n }\n\n renderGroup(group: IGroup, drawContext: IDrawContext, parentMatrix: IMatrix, skipSort?: boolean) {\n if (drawContext.break || group.attribute.visibleAll === false) {\n return;\n }\n if (group.incremental && (drawContext.startAtId == null || drawContext.startAtId === group._uid)) {\n drawContext.break = true;\n this._increaseRender(group, drawContext);\n return;\n }\n\n if (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {\n return;\n }\n\n let nextM: IMatrix = parentMatrix;\n let tempBounds: IBounds;\n\n if (this.useDirtyBounds) {\n tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);\n // 变换dirtyBounds\n const gm = group.transMatrix;\n nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f);\n // const m = group.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());\n }\n\n this.renderItem(group, drawContext, {\n drawingCb: () => {\n skipSort\n ? group.forEachChildren((item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n })\n : foreach(\n group,\n DefaultAttribute.zIndex,\n (item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n },\n false,\n !!drawContext.context?.camera\n );\n }\n });\n\n if (this.useDirtyBounds) {\n this.dirtyBounds.copy(tempBounds);\n boundsAllocate.free(tempBounds);\n matrixAllocate.free(nextM);\n }\n }\n\n protected _increaseRender(group: IGroup, drawContext: IDrawContext) {\n const { layer, stage } = drawContext;\n const { subLayers } = layer;\n // 获取渐进渲染层\n let incrementalLayer = subLayers.get(group._uid);\n if (!incrementalLayer) {\n incrementalLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size,\n group\n };\n subLayers.set(group._uid, incrementalLayer);\n }\n // 渲染\n const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext();\n const idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);\n idc.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n idc.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n (idc as any).draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: incrementalLayer.layer,\n context: incrementalContext,\n startAtId: group._uid,\n break: false\n });\n incrementalLayer.drawContribution = idc;\n // this.draw(this.currentRenderService, {...this.drawParams, startAtId: group._uid})\n // this.draw(this.currentRenderService, {...this.drawParams, clear: 'transparent', layer: incrementalContext.layer, context: incrementalContext, startAtId: group._uid})\n const nextGraphic = this._findNextGraphic(group);\n if (nextGraphic) {\n // 如果是下一个渐进渲染层,那就再来一次\n if (nextGraphic.isContainer && nextGraphic.incremental) {\n this._increaseRender(nextGraphic as IGroup, drawContext);\n } else {\n // 如果不是渐进渲染层,那就默认图层渲染\n let afterLayer = subLayers.get(nextGraphic._uid);\n if (!afterLayer) {\n afterLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size\n };\n subLayers.set(nextGraphic._uid, afterLayer);\n }\n const afterContext = afterLayer.layer.getNativeHandler().getContext();\n this.draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: afterLayer.layer,\n context: afterContext,\n startAtId: nextGraphic._uid,\n break: false\n });\n }\n }\n }\n\n getRenderContribution(graphic: IGraphic): IGraphicRender | null {\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType, graphic);\n }\n if (!renderer) {\n renderer = this.selectRenderByType(graphic.type);\n }\n return renderer;\n }\n\n renderItem(graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (\n drawContribution.beforeDrawItem &&\n drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)\n ) {\n return;\n }\n }\n }\n\n const renderer = this.getRenderContribution(graphic);\n if (!renderer) {\n return;\n }\n\n let retrans: boolean = this.scrollMatrix && (this.scrollMatrix.e !== 0 || this.scrollMatrix.f !== 0);\n let tempBounds: IBounds;\n\n if (graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n if (!!(scrollX || scrollY)) {\n retrans = true;\n if (!this.scrollMatrix) {\n this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n }\n this.scrollMatrix.translate(-scrollX, -scrollY);\n }\n }\n // 需要二次变化,那就重新算一个变换后的Bounds\n if (retrans) {\n tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix);\n }\n\n if (\n this.useDirtyBounds &&\n !(graphic.isContainer || isRectIntersect(graphic.AABBBounds, tempBounds ?? this.dirtyBounds, false))\n ) {\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n return;\n }\n\n const skipDraw = drawContext.startAtId != null && graphic._uid !== drawContext.startAtId;\n if (graphic._uid === drawContext.startAtId) {\n drawContext.startAtId = null;\n }\n params && (params.skipDraw = skipDraw);\n if (skipDraw) {\n graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params);\n } else {\n renderer.draw(graphic, this.currentRenderService, drawContext, params);\n }\n\n // retrans && this.dirtyBounds.copy(tempBounds);\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.afterDrawItem) {\n if (drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) {\n return;\n }\n }\n }\n }\n }\n // 根据type选择对应的render\n protected selectRenderByType(type?: string): IGraphicRender | null {\n Logger.getInstance().warn('未知错误,不应该走到这里');\n return null;\n }\n // 根据type选择对应的render\n protected selectRenderByNumberType(type: number, graphic: IGraphic): IGraphicRender | null {\n let data;\n if (graphic.attribute.renderStyle) {\n const currentRenderMap = this.styleRenderMap.get(graphic.attribute.renderStyle);\n data = currentRenderMap && currentRenderMap.get(type);\n }\n return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear, viewBox } = drawContext;\n // 已经translate过了\n const x = 0;\n const y = 0;\n const width = viewBox.width();\n const height = viewBox.height();\n if (clear) {\n context.clearRect(x, y, width, height);\n const stage = renderService.drawParams?.stage;\n stage && (context.globalAlpha = (stage as any).attribute.opacity ?? 1);\n if (stage && (stage as any).backgroundImg && (stage as any).resources) {\n const res = (stage as any).resources.get(clear);\n if (res && res.state === 'success' && res.data) {\n context.drawImage(res.data, x, y, width, height);\n }\n } else {\n context.fillStyle = createColor(\n context,\n clear,\n {\n AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }\n },\n 0,\n 0\n );\n context.fillRect(x, y, width, height);\n }\n }\n }\n\n afterDraw(renderService: IRenderService, drawParams: IDrawContext) {\n return;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/draw-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAwF;AAexF,+CAAgE;AAEhE,iFAA6E;AAC7E,oDAA2D;AAE3D,6CAAqF;AACrF,kDAA+C;AAC/C,qCAAsE;AACtE,yDAAyD;AACzD,+DAA2D;AAE3D,wEAAoE;AACpE,wEAAoE;AACpE,sDAAmD;AAM5C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAgBlC,YAIiD,aAA+B,EAK3D,gCAAyF;QAL7D,kBAAa,GAAb,aAAa,CAAkB;QAK3D,qCAAg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S,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAChD,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE;oBAC9C,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;iBAClD;aACF;iBAAM;gBACL,OAAO,CAAC,SAAS,GAAG,IAAA,0BAAW,EAC7B,OAAO,EACP,KAAK,EACL;oBACE,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE;iBAC5D,EACD,CAAC,EACD,CAAC,CACF,CAAC;gBACF,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;aACvC;SACF;IACH,CAAC;IAED,SAAS,CAAC,aAA6B,EAAE,UAAwB;QAC/D,OAAO;IACT,CAAC;CACF,CAAA;AAhbY,uBAAuB;IADnC,IAAA,2BAAU,GAAE;IAqBR,WAAA,IAAA,4BAAW,EAAC,sBAAa,CAAC,CAAA;IAG1B,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,sCAAmB,CAAC,CAAA;;GAxBlB,uBAAuB,CAgbnC;AAhbY,0DAAuB","file":"draw-contribution.js","sourcesContent":["import { injectable, inject, named, multiInject } from '../../../common/inversify-lite';\nimport type {\n IContext2d,\n MaybePromise,\n IGraphic,\n IGroup,\n IDrawContext,\n IRenderService,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IContributionProvider,\n IDrawItemInterceptorContribution,\n IDrawContribution,\n IGlobal\n} from '../../../interface';\nimport { findNextGraphic, foreach } from '../../../common/sort';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { DefaultAttribute } from '../../../graphic/config';\nimport type { IAABBBounds, IBounds, IMatrix } from '@visactor/vutils';\nimport { Bounds, Logger, getRectIntersect, isRectIntersect } from '@visactor/vutils';\nimport { container } from '../../../container';\nimport { GraphicRender, IncrementalDrawContribution } from './symbol';\nimport { DrawItemInterceptor } from './draw-interceptor';\nimport { createColor } from '../../../common/canvas-utils';\nimport type { ILayerService } from '../../../interface/core';\nimport { boundsAllocate } from '../../../allocator/bounds-allocate';\nimport { matrixAllocate } from '../../../allocator/matrix-allocate';\nimport { application } from '../../../application';\n\n/**\n * 默认的渲染contribution,基于树状结构针对图元的渲染\n */\n@injectable()\nexport class DefaultDrawContribution implements IDrawContribution {\n declare currentRenderMap: Map<number, IGraphicRender>;\n declare defaultRenderMap: Map<number, IGraphicRender>;\n declare styleRenderMap: Map<string, Map<number, IGraphicRender>>;\n declare dirtyBounds: IBounds;\n declare backupDirtyBounds: IBounds;\n // 是否使用dirtyBounds\n declare useDirtyBounds: boolean;\n declare currentRenderService: IRenderService;\n declare InterceptorContributions: IDrawItemInterceptorContribution[];\n\n declare global: IGlobal;\n declare layerService: ILayerService;\n\n declare scrollMatrix?: IMatrix;\n\n constructor(\n // @inject(ContributionProvider)\n // @named(GraphicRender)\n // protected readonly contributions: ContributionProvider<IGraphicRender>,\n @multiInject(GraphicRender) protected readonly contributions: IGraphicRender[],\n // @inject(RenderSelector) protected readonly renderSelector: IRenderSelector, // 根据图元类型选择对应的renderItem进行渲染\n // 拦截器\n @inject(ContributionProvider)\n @named(DrawItemInterceptor)\n protected readonly drawItemInterceptorContributions: IContributionProvider<IDrawItemInterceptorContribution>\n ) {\n this.currentRenderMap = new Map();\n this.defaultRenderMap = new Map();\n this.styleRenderMap = new Map();\n this.dirtyBounds = new Bounds();\n this.backupDirtyBounds = new Bounds();\n this.global = application.global;\n this.layerService = application.layerService;\n this.init();\n }\n\n init() {\n this.contributions.forEach(item => {\n if (item.style) {\n const map = this.styleRenderMap.get(item.style) || new Map();\n map.set(item.numberType, item);\n this.styleRenderMap.set(item.style, map);\n } else {\n this.defaultRenderMap.set(item.numberType, item);\n }\n });\n this.InterceptorContributions = this.drawItemInterceptorContributions\n .getContributions()\n .sort((a, b) => a.order - b.order);\n }\n\n prepareForDraw(renderService: IRenderService, drawContext: IDrawContext) {\n // 有dirtyBounds用dirtyBounds\n if (drawContext.updateBounds) {\n this.useDirtyBounds = true;\n } else {\n // 没有的话,看看是否需要跳过outRange的渲染\n this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;\n }\n }\n\n draw(renderService: IRenderService, drawContext: IDrawContext): MaybePromise<void> {\n this.prepareForDraw(renderService, drawContext);\n drawContext.drawContribution = this;\n this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap;\n // this.startAtId = drawParams.startAtId;\n this.currentRenderService = renderService;\n // this.drawParams = drawParams;\n const { context, stage, viewBox, transMatrix } = drawContext;\n\n if (!context) {\n return;\n }\n // if (context.drawPromise) {\n // return;\n // }\n const dirtyBounds: IBounds | undefined = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());\n if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {\n const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, false);\n dirtyBounds.x1 = Math.floor(b.x1);\n dirtyBounds.y1 = Math.floor(b.y1);\n dirtyBounds.x2 = Math.ceil(b.x2);\n dirtyBounds.y2 = Math.ceil(b.y2);\n }\n // 如果dpr不是整数或者.5的小数,需要格式化dirtyBounds\n const d = context.dpr % 1;\n if (d || d !== 0.5) {\n dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr;\n dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr;\n dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr;\n dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr;\n }\n this.backupDirtyBounds.copy(dirtyBounds);\n context.inuse = true;\n context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f);\n // 初始化context\n context.clearMatrix();\n context.setTransformForCurrent(true);\n\n // const drawInArea =\n // dirtyBounds.width() * context.dpr < context.canvas.width ||\n // dirtyBounds.height() * context.dpr < context.canvas.height;\n // context.save();\n\n // 设置translate\n context.translate(viewBox.x1, viewBox.y1, true);\n context.beginPath();\n context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height());\n context.clip();\n\n // 如果存在3d视角,那么不使用dirtyBounds\n if (stage.camera) {\n this.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n this.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n }\n\n this.clearScreen(renderService, context, drawContext);\n // // 渲染的时候图元的起始位置就是x,y\n // this.backupDirtyBounds.translate(-x, -y);\n // this.dirtyBounds.translate(-x, -y);\n\n // // 设置translate\n // context.translate(x, y, true);\n\n context.save();\n renderService.renderTreeRoots\n .sort((a, b) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach(group => {\n group.isContainer\n ? this.renderGroup(group as IGroup, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0))\n : this.renderItem(group as IGraphic, drawContext);\n });\n\n // context.restore();\n context.restore();\n context.setClearMatrix(1, 0, 0, 1, 0, 0);\n // this.break = false;\n context.inuse = false;\n context.draw();\n }\n\n doRegister() {\n throw new Error('暂不支持');\n }\n\n // 找到下一个graphic\n protected _findNextGraphic(group: IGroup): IGraphic | null {\n let parent = group.parent;\n let id = group._uid;\n while (parent) {\n const g = findNextGraphic(parent, id, DefaultAttribute.zIndex);\n if (g) {\n return g;\n }\n id = parent._uid;\n parent = parent.parent;\n }\n return null;\n }\n\n renderGroup(group: IGroup, drawContext: IDrawContext, parentMatrix: IMatrix, skipSort?: boolean) {\n if (drawContext.break || group.attribute.visibleAll === false) {\n return;\n }\n if (group.incremental && (drawContext.startAtId == null || drawContext.startAtId === group._uid)) {\n drawContext.break = true;\n this._increaseRender(group, drawContext);\n return;\n }\n\n if (\n this.useDirtyBounds &&\n !isRectIntersect(group.AABBBounds, this.dirtyBounds, false) &&\n group.attribute.boundsMode !== 'empty'\n ) {\n return;\n }\n\n let nextM: IMatrix = parentMatrix;\n let tempBounds: IBounds;\n\n if (this.useDirtyBounds) {\n tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);\n // 变换dirtyBounds\n const gm = group.transMatrix;\n nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f);\n // const m = group.globalTransMatrix.getInverse();\n this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());\n }\n\n this.renderItem(group, drawContext, {\n drawingCb: () => {\n skipSort\n ? group.forEachChildren((item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n })\n : foreach(\n group,\n DefaultAttribute.zIndex,\n (item: IGraphic) => {\n if (drawContext.break) {\n return;\n }\n if (item.isContainer) {\n this.renderGroup(item as IGroup, drawContext, nextM);\n } else {\n this.renderItem(item, drawContext);\n }\n },\n false,\n !!drawContext.context?.camera\n );\n }\n });\n\n if (this.useDirtyBounds) {\n this.dirtyBounds.copy(tempBounds);\n boundsAllocate.free(tempBounds);\n matrixAllocate.free(nextM);\n }\n }\n\n protected _increaseRender(group: IGroup, drawContext: IDrawContext) {\n const { layer, stage } = drawContext;\n const { subLayers } = layer;\n // 获取渐进渲染层\n let incrementalLayer = subLayers.get(group._uid);\n if (!incrementalLayer) {\n incrementalLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size,\n group\n };\n subLayers.set(group._uid, incrementalLayer);\n }\n // 渲染\n const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext();\n const idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);\n idc.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n idc.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n (idc as any).draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: incrementalLayer.layer,\n context: incrementalContext,\n startAtId: group._uid,\n break: false\n });\n incrementalLayer.drawContribution = idc;\n // this.draw(this.currentRenderService, {...this.drawParams, startAtId: group._uid})\n // this.draw(this.currentRenderService, {...this.drawParams, clear: 'transparent', layer: incrementalContext.layer, context: incrementalContext, startAtId: group._uid})\n const nextGraphic = this._findNextGraphic(group);\n if (nextGraphic) {\n // 如果是下一个渐进渲染层,那就再来一次\n if (nextGraphic.isContainer && nextGraphic.incremental) {\n this._increaseRender(nextGraphic as IGroup, drawContext);\n } else {\n // 如果不是渐进渲染层,那就默认图层渲染\n let afterLayer = subLayers.get(nextGraphic._uid);\n if (!afterLayer) {\n afterLayer = {\n layer: this.layerService.createLayer(stage),\n zIndex: subLayers.size\n };\n subLayers.set(nextGraphic._uid, afterLayer);\n }\n const afterContext = afterLayer.layer.getNativeHandler().getContext();\n this.draw(this.currentRenderService, {\n ...drawContext,\n drawContribution: idc,\n clear: 'transparent',\n layer: afterLayer.layer,\n context: afterContext,\n startAtId: nextGraphic._uid,\n break: false\n });\n }\n }\n }\n\n getRenderContribution(graphic: IGraphic): IGraphicRender | null {\n let renderer;\n if (!renderer) {\n renderer = this.selectRenderByNumberType(graphic.numberType, graphic);\n }\n if (!renderer) {\n renderer = this.selectRenderByType(graphic.type);\n }\n return renderer;\n }\n\n renderItem(graphic: IGraphic, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (\n drawContribution.beforeDrawItem &&\n drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)\n ) {\n return;\n }\n }\n }\n\n const renderer = this.getRenderContribution(graphic);\n if (!renderer) {\n return;\n }\n\n let retrans: boolean = this.scrollMatrix && (this.scrollMatrix.e !== 0 || this.scrollMatrix.f !== 0);\n let tempBounds: IBounds;\n\n if (graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n if (!!(scrollX || scrollY)) {\n retrans = true;\n if (!this.scrollMatrix) {\n this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n }\n this.scrollMatrix.translate(-scrollX, -scrollY);\n }\n }\n // 需要二次变化,那就重新算一个变换后的Bounds\n if (retrans) {\n tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix);\n }\n\n if (\n this.useDirtyBounds &&\n !(\n graphic.isContainer ||\n graphic.attribute.boundsMode === 'empty' ||\n isRectIntersect(graphic.AABBBounds, tempBounds ?? this.dirtyBounds, false)\n )\n ) {\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n return;\n }\n\n const skipDraw = drawContext.startAtId != null && graphic._uid !== drawContext.startAtId;\n if (graphic._uid === drawContext.startAtId) {\n drawContext.startAtId = null;\n }\n params && (params.skipDraw = skipDraw);\n if (skipDraw) {\n graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params);\n } else {\n renderer.draw(graphic, this.currentRenderService, drawContext, params);\n }\n\n // retrans && this.dirtyBounds.copy(tempBounds);\n if (retrans && graphic.parent) {\n const { scrollX = 0, scrollY = 0 } = graphic.parent.attribute;\n this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);\n }\n\n // 添加拦截器\n if (this.InterceptorContributions.length) {\n for (let i = 0; i < this.InterceptorContributions.length; i++) {\n const drawContribution = this.InterceptorContributions[i];\n if (drawContribution.afterDrawItem) {\n if (drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) {\n return;\n }\n }\n }\n }\n }\n // 根据type选择对应的render\n protected selectRenderByType(type?: string): IGraphicRender | null {\n Logger.getInstance().warn('未知错误,不应该走到这里');\n return null;\n }\n // 根据type选择对应的render\n protected selectRenderByNumberType(type: number, graphic: IGraphic): IGraphicRender | null {\n let data;\n if (graphic.attribute.renderStyle) {\n const currentRenderMap = this.styleRenderMap.get(graphic.attribute.renderStyle);\n data = currentRenderMap && currentRenderMap.get(type);\n }\n return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);\n }\n\n protected clearScreen(renderService: IRenderService, context: IContext2d, drawContext: IDrawContext) {\n const { clear, viewBox } = drawContext;\n // 已经translate过了\n const x = 0;\n const y = 0;\n const width = viewBox.width();\n const height = viewBox.height();\n if (clear) {\n context.clearRect(x, y, width, height);\n const stage = renderService.drawParams?.stage;\n stage && (context.globalAlpha = (stage as any).attribute.opacity ?? 1);\n if (stage && (stage as any).backgroundImg && (stage as any).resources) {\n const res = (stage as any).resources.get(clear);\n if (res && res.state === 'success' && res.data) {\n context.drawImage(res.data, x, y, width, height);\n }\n } else {\n context.fillStyle = createColor(\n context,\n clear,\n {\n AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }\n },\n 0,\n 0\n );\n context.fillRect(x, y, width, height);\n }\n }\n }\n\n afterDraw(renderService: IRenderService, drawParams: IDrawContext) {\n return;\n }\n}\n"]}
|