将浮动窗口Area拖动到独立中心指示器外面放开,效果和在独立中心指示器上放开是一样的,都实现了停靠。这不合逻辑,只有在独立中心指示器上放开才应该停靠
This commit is contained in:
@@ -564,7 +564,8 @@ const onPanelDragEnd = () => {
|
|||||||
panelDragState.value.currentAreaId = null
|
panelDragState.value.currentAreaId = null
|
||||||
|
|
||||||
// 3.1 在onPanelDragEnd方法中添加中心停靠检测
|
// 3.1 在onPanelDragEnd方法中添加中心停靠检测
|
||||||
if (activeDockZone.value === 'center' && currentAreaId) {
|
// 确保只有在独立中心指示器区域内释放才执行停靠
|
||||||
|
if (activeDockZone.value === 'center' && currentAreaId && isMouseInCenterIndicator(currentMousePosition.value.x, currentMousePosition.value.y)) {
|
||||||
// 处理中心停靠
|
// 处理中心停靠
|
||||||
const result = handleCenterDocking(currentAreaId)
|
const result = handleCenterDocking(currentAreaId)
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -642,7 +643,8 @@ const onAreaDragEnd = (areaId, event) => {
|
|||||||
panelDragState.value.currentAreaId = null
|
panelDragState.value.currentAreaId = null
|
||||||
|
|
||||||
// 3.1 在onAreaDragEnd方法中添加中心停靠检测
|
// 3.1 在onAreaDragEnd方法中添加中心停靠检测
|
||||||
if (activeDockZone.value === 'center') {
|
// 确保只有在独立中心指示器区域内释放才执行停靠
|
||||||
|
if (activeDockZone.value === 'center' && isMouseInCenterIndicator(currentMousePosition.value.x, currentMousePosition.value.y)) {
|
||||||
// 处理中心停靠
|
// 处理中心停靠
|
||||||
const result = handleCenterDocking(areaId)
|
const result = handleCenterDocking(areaId)
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -768,7 +770,8 @@ const onTabDragEnd = () => {
|
|||||||
tabDragState.value.currentAreaId = null
|
tabDragState.value.currentAreaId = null
|
||||||
|
|
||||||
// 3.2 在onTabDragEnd方法中添加中心停靠检测
|
// 3.2 在onTabDragEnd方法中添加中心停靠检测
|
||||||
if (activeDockZone.value === 'center' && currentAreaId) {
|
// 确保只有在独立中心指示器区域内释放才执行停靠
|
||||||
|
if (activeDockZone.value === 'center' && currentAreaId && isMouseInCenterIndicator(currentMousePosition.value.x, currentMousePosition.value.y)) {
|
||||||
// 处理中心停靠
|
// 处理中心停靠
|
||||||
const result = handleCenterDocking(currentAreaId)
|
const result = handleCenterDocking(currentAreaId)
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -1004,6 +1007,31 @@ const onPanelMaximizeSync = ({ areaId, maximized }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 第2步:Area验证逻辑 - 目标Area内容区为空的情况
|
// 第2步:Area验证逻辑 - 目标Area内容区为空的情况
|
||||||
|
/**
|
||||||
|
* 检查鼠标是否在独立中心指示器区域内
|
||||||
|
* @param {number} mouseX - 鼠标X坐标
|
||||||
|
* @param {number} mouseY - 鼠标Y坐标
|
||||||
|
* @returns {boolean} 是否在独立中心指示器区域内
|
||||||
|
*/
|
||||||
|
const isMouseInCenterIndicator = (mouseX, mouseY) => {
|
||||||
|
if (!dockLayoutRef.value) return false
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 查找独立中心指示器元素
|
||||||
|
const centerIndicator = dockLayoutRef.value.querySelector('.center-main-indicator')
|
||||||
|
if (!centerIndicator) return false
|
||||||
|
|
||||||
|
const rect = centerIndicator.getBoundingClientRect()
|
||||||
|
|
||||||
|
// 检查鼠标是否在独立中心指示器的边界框内
|
||||||
|
return mouseX >= rect.left && mouseX <= rect.right &&
|
||||||
|
mouseY >= rect.top && mouseY <= rect.bottom
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('检查独立中心指示器区域时出错:', error)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查Area是否可以停靠到中心区域
|
* 检查Area是否可以停靠到中心区域
|
||||||
* @param {Object} sourceArea - 源Area对象
|
* @param {Object} sourceArea - 源Area对象
|
||||||
|
|||||||
Reference in New Issue
Block a user