源代码:https://github.com/linuxdeepin/dde/blob/develop/resources/desktop/js/desktop_item.coffee
_DND_DATA_TYPE_NAME_ = "text/operate-type"
_DND_DESKTOP_MARK_ = "desktop_internal"
_SET_DND_INTERNAL_FLAG_ = (evt) ->
evt.dataTransfer.setData(_DND_DATA_TYPE_NAME_, _DND_DESKTOP_MARK_)
_IS_DND_INTERLNAL_ = (evt) ->
evt.dataTransfer.getData(_DND_DATA_TYPE_NAME_) == _DND_DESKTOP_MARK_
do_drop : (evt) ->
if _IS_DND_INTERLNAL_(evt)
if not @selected
evt.stopPropagation()
evt.preventDefault()
@display_not_hover()
else
evt.stopPropagation()
evt.preventDefault()
if not @selected
@display_not_hover()
return
echo "RichDir do_drop"
super
if _IS_DND_INTERLNAL_(evt) and @selected
echo "_IS_DND_INTERLNAL_(evt)"
else
echo "move"
tmp_list = []
for file in evt.dataTransfer.files
e = DCore.DEntry.create_by_path(decodeURI(file.path).replace(/^file:\/\//i, ""))
if not e? then continue
# if DCore.DEntry.get_type(e) == FILE_TYPE_APP then tmp_list.push(e)
tmp_list.push(e)
if tmp_list.length > 0 then DCore.DEntry.move(tmp_list, @_entry, true)
return
本文详细解析了桌面环境中拖放操作的实现原理,包括内部标志设置、检查等关键步骤,并展示了如何根据不同情况处理文件移动。
:桌面item拖动详解&spm=1001.2101.3001.5002&articleId=9719321&d=1&t=3&u=d5d795a0794343bc822e14273faf0536)
1465

被折叠的 条评论
为什么被折叠?



