TASK: #115114 - 调整编辑模式容器组件的逻辑
This commit is contained in:
parent
9fa108a8e2
commit
2858d63093
|
@ -390,8 +390,12 @@ export default class StarDock extends StarBaseElement {
|
|||
set sortMode(value) {
|
||||
if (value) {
|
||||
this._dnd.delay = 0
|
||||
this.gestureDetector.setOption('holdThreshold', 100)
|
||||
this.setAttribute('sort-mode', '')
|
||||
} else {
|
||||
this._dnd.delay = DEFAULT_DND_TIMEOUT
|
||||
this.gestureDetector.setOption('holdThreshold', DEFAULT_DND_TIMEOUT)
|
||||
this.removeAttribute('sort-mode')
|
||||
}
|
||||
this._sortMode = value
|
||||
}
|
||||
|
|
|
@ -494,17 +494,15 @@ class GaiaContainer extends StarBaseElement {
|
|||
|
||||
set sortMode(value) {
|
||||
if (value) {
|
||||
this._dnd.delay = 0
|
||||
this.status |= STATUS.SORT
|
||||
// @ts-ignore
|
||||
this.gestureDetector.setOption('holdThreshold', 100)
|
||||
this.firstUpdated().then(this.addTailPage)
|
||||
this.setAttribute('sort-mode', '')
|
||||
} else {
|
||||
this._dnd.delay = DEFAULT_DND_TIMEOUT
|
||||
this.status &= ~STATUS.SORT
|
||||
// @ts-ignore
|
||||
this.gestureDetector.setOption('holdThreshold', DEFAULT_DND_TIMEOUT)
|
||||
this.removeTailPage()
|
||||
this.removeAttribute('sort-mode')
|
||||
}
|
||||
this._sortMode = value
|
||||
}
|
||||
|
@ -971,14 +969,19 @@ class GaiaContainer extends StarBaseElement {
|
|||
this.pageHeight = page.offsetHeight
|
||||
this.gridHeight = this.pageHeight / this.row
|
||||
this.gridWidth = this.pageWidth / this.column
|
||||
this.style.setProperty('--grid-height', this.gridHeight + 'px')
|
||||
this.style.setProperty('--grid-width', this.gridWidth + 'px')
|
||||
}
|
||||
return page
|
||||
}
|
||||
|
||||
addTailPage() {
|
||||
addTailPage = () => {
|
||||
if (this._status & STATUS.DRAG || this._status & STATUS.SORT) {
|
||||
// 仅仅在拖动状态和编辑状态时,允许添加空白尾页
|
||||
if (this.pages[this.pagination] == this.pages._tail) {
|
||||
if (
|
||||
this.pages[this.pagination] == this.pages._tail &&
|
||||
this.pages[this.pagination].children.length
|
||||
) {
|
||||
// 当当前页为尾页时,再行添加尾页前,需要去掉当前页面的尾页标记
|
||||
this.pages._tail = undefined
|
||||
}
|
||||
|
@ -2014,18 +2017,18 @@ class GaiaContainer extends StarBaseElement {
|
|||
break
|
||||
|
||||
case 'click':
|
||||
if (this._dnd.clickCapture) {
|
||||
this._dnd.clickCapture = false
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
}
|
||||
// if (this._dnd.clickCapture) {
|
||||
// this._dnd.clickCapture = false
|
||||
// event.preventDefault()
|
||||
// event.stopImmediatePropagation()
|
||||
// }
|
||||
|
||||
if (this._dnd?.child?.isFolder) {
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
this._dnd.child.open()
|
||||
this.cancelDrag()
|
||||
}
|
||||
this.cancelDrag()
|
||||
break
|
||||
|
||||
case 'contextmenu':
|
||||
|
@ -2154,7 +2157,7 @@ class GaiaContainer extends StarBaseElement {
|
|||
}
|
||||
|
||||
handleMove(event: CustomEvent) {
|
||||
if (!this.turnEvent || this.turnEvent == event.type) {
|
||||
if ((!this.turnEvent || this.turnEvent == event.type) && this.istouching) {
|
||||
this.turnEvent = event.type
|
||||
} else {
|
||||
return
|
||||
|
@ -2165,11 +2168,10 @@ class GaiaContainer extends StarBaseElement {
|
|||
|
||||
this.handleTransformRatio(this.panDistanceX)
|
||||
this.continueDrag()
|
||||
this.istouching &&
|
||||
(this.status |= STATUS.SWIPE) &&
|
||||
(this.style.transform = `translateX(${
|
||||
parseInt(String(this.panDistanceX * this.ratio)) + this.offsetX
|
||||
}px`)
|
||||
this.status |= STATUS.SWIPE
|
||||
this.style.transform = `translateX(${
|
||||
parseInt(String(this.panDistanceX * this.ratio)) + this.offsetX
|
||||
}px`
|
||||
}
|
||||
|
||||
handleEnd(event: CustomEvent) {
|
||||
|
|
|
@ -108,13 +108,13 @@ class GaiaContainerPage {
|
|||
const pages = this.addPage()
|
||||
this._tail = pages.page
|
||||
this._shadowTail = pages.shadowPage
|
||||
this._suspending.push(this._tail)
|
||||
this._manager.addPage({page: this._tail, shadowPage: this._shadowTail})
|
||||
}
|
||||
}
|
||||
|
||||
removeTail = () => {
|
||||
if (!this._tail) return
|
||||
this.deletePage(this._tail)
|
||||
this._tail = undefined
|
||||
this._shadowTail = undefined
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue