fix:table cursor position in page header

pr675
Hufe921 3 years ago
parent 7b4b33b5c5
commit 85a2bbea60

@ -1318,7 +1318,7 @@ export class Draw {
const positionContext = this.position.getPositionContext() const positionContext = this.position.getPositionContext()
if (positionContext.isTable) { if (positionContext.isTable) {
const { index, trIndex, tdIndex } = positionContext const { index, trIndex, tdIndex } = positionContext
const elementList = this.getElementList() const elementList = this.getOriginalElementList()
const tablePositionList = elementList[index!].trList?.[trIndex!].tdList[tdIndex!].positionList const tablePositionList = elementList[index!].trList?.[trIndex!].tdList[tdIndex!].positionList
if (curIndex === undefined && tablePositionList) { if (curIndex === undefined && tablePositionList) {
curIndex = tablePositionList.length - 1 curIndex = tablePositionList.length - 1

@ -11,8 +11,8 @@ function dblclick(host: CanvasEvent, evt: MouseEvent) {
y: evt.offsetY y: evt.offsetY
}) })
if (!~positionContext.index && positionContext.zone) { if (!~positionContext.index && positionContext.zone) {
const zoneManager = draw.getZone() draw.getZone().setZone(positionContext.zone)
zoneManager.setZone(positionContext.zone) draw.getRange().clearRange()
draw.render({ draw.render({
isSubmitHistory: false, isSubmitHistory: false,
isSetCursor: false, isSetCursor: false,

@ -35,16 +35,14 @@ export class Position {
} }
public getPositionList(): IElementPosition[] { public getPositionList(): IElementPosition[] {
const elementList = this.draw.getElementList()
return this.positionContext.isTable return this.positionContext.isTable
? this.getTablePositionList(elementList) ? this.getTablePositionList(this.draw.getOriginalElementList())
: this.getOriginalPositionList() : this.getOriginalPositionList()
} }
public getMainPositionList(): IElementPosition[] { public getMainPositionList(): IElementPosition[] {
const elementList = this.draw.getMainElementList()
return this.positionContext.isTable return this.positionContext.isTable
? this.getTablePositionList(elementList) ? this.getTablePositionList(this.draw.getOriginalMainElementList())
: this.positionList : this.positionList
} }

@ -34,6 +34,10 @@ export class RangeManager {
return this.range return this.range
} }
public clearRange() {
this.setRange(-1, -1)
}
public getSelection(): IElement[] | null { public getSelection(): IElement[] | null {
const { startIndex, endIndex } = this.range const { startIndex, endIndex } = this.range
if (startIndex === endIndex) return null if (startIndex === endIndex) return null

Loading…
Cancel
Save