dsh-xueqiu 1.2.0 → 1.2.1

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/dynamic/client.js CHANGED
@@ -348,6 +348,8 @@ return {
348
348
  // 拖拽 / 缩放用可变引用(实例唯一)
349
349
  let dragRef = null
350
350
  let resizeRef = null
351
+ let dragStart = null
352
+ let suppressSnap = false
351
353
 
352
354
  // ---------- 面板内容(数据 + tabs + 详情),由悬浮/嵌入外壳共用 ----------
353
355
  function XueqiuPanel() {
@@ -784,14 +786,11 @@ return {
784
786
  // 拖拽(贴靠状态下按下标题栏 → 解除贴靠回到自由)
785
787
  function onTitleDown(e) {
786
788
  if (e.pointerType === 'mouse' && e.button !== 0) return
789
+ dragStart = { x: e.clientX, y: e.clientY }
787
790
  if (ui.snapEdge) {
788
- const vp = viewport()
789
- if (vp) {
790
- const x = ui.snapEdge === 'right' ? vp.w - ui.snapW : 0
791
- ui.set({ snapEdge: null, pos: { x: x, y: 0 }, snap: null })
792
- } else {
793
- ui.set({ snapEdge: null, pos: { x: e.clientX - 60, y: e.clientY - 20 }, snap: null })
794
- }
791
+ // 解除贴靠:面板从按下位置转为自由,本次松手不再磁吸
792
+ ui.set({ snapEdge: null, snap: null, pos: { x: e.clientX - 30, y: e.clientY - 16 } })
793
+ suppressSnap = true
795
794
  }
796
795
  const baseX = ui.pos ? ui.pos.x : e.clientX
797
796
  const baseY = ui.pos ? ui.pos.y : e.clientY
@@ -811,15 +810,18 @@ return {
811
810
  }
812
811
  }
813
812
  function onTitleUp(e) {
813
+ const moved = dragStart ? Math.sqrt(Math.pow(e.clientX - dragStart.x, 2) + Math.pow(e.clientY - dragStart.y, 2)) : 0
814
814
  dragRef = null
815
+ dragStart = null
815
816
  try { if (e.currentTarget.hasPointerCapture(e.pointerId)) e.currentTarget.releasePointerCapture(e.pointerId) } catch (err) { /* ignore */ }
817
+ if (suppressSnap) { suppressSnap = false; setDragTarget(null); return }
816
818
  if (dragTarget) {
817
819
  ui.set({ snapEdge: dragTarget, pos: null, snap: null, snapW: ui.snapW || 380 })
818
820
  setDragTarget(null)
819
821
  return
820
822
  }
821
823
  setDragTarget(null)
822
- snapCheck()
824
+ if (moved >= 6) snapCheck()
823
825
  }
824
826
  // 四角磁吸:拖放终点靠近任一屏幕角 → 吸附
825
827
  function snapCheck() {
@@ -898,11 +900,11 @@ return {
898
900
  else if (ui.snapEdge === 'left') minStyle = { left: 0, top: 0, bottom: 0, width: ui.snapW, height: 'auto' }
899
901
  else if (ui.pos) minStyle = { left: ui.pos.x, top: ui.pos.y, right: 'auto', bottom: 'auto' }
900
902
  return el('div', { className: 'xq-wrap' }, [
901
- el('div', { key: 'min', className: 'xq-float xq-min' + (ui.snapEdge ? ' xq-snapped' : ''), style: minStyle, ...dragProps, onClick: function () { ui.set({ minimized: false }) } }, [
903
+ el('div', { key: 'min', className: 'xq-float xq-min' + (ui.snapEdge ? ' xq-snapped' : ''), style: minStyle, onClick: function () { ui.set({ minimized: false }) } }, [
902
904
  el('span', { key: 'logo', className: 'xq-logo' }, [el('b', { key: 'b' }, '雪球'), ' mini']),
903
905
  el('span', { key: 'sum', className: 'xq-sum' }, idxLine || '点击展开行情面板'),
904
906
  el('span', { key: 'sp', className: 'xq-spacer' }),
905
- el('button', { key: 'x', className: 'xq-btn-mini', onPointerDown: function (e) { e.stopPropagation() }, onClick: function (e) { e.stopPropagation(); ui.set({ closed: true }) } }, '✕'),
907
+ el('button', { key: 'x', className: 'xq-btn-mini', onClick: function (e) { e.stopPropagation(); ui.set({ closed: true }) } }, '✕'),
906
908
  el('span', { key: 'caret', className: 'xq-caret' }, '展开 ▾')
907
909
  ]),
908
910
  snapPreview
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-xueqiu",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "雪球 mini 行情面板 — DeepSeek Harness 免登录 A股/港美股实时行情、K线(蜡烛/成交量/均线)、分时图、热榜、搜索、7x24 快讯、热议用户。可拖拽悬浮面板,交易时段智能刷新。",
5
5
  "keywords": [
6
6
  "dsh",
@@ -353,6 +353,8 @@ export default {
353
353
  // 拖拽 / 缩放用可变引用(实例唯一)
354
354
  let dragRef = null
355
355
  let resizeRef = null
356
+ let dragStart = null
357
+ let suppressSnap = false
356
358
 
357
359
  // ---------- 面板内容(数据 + tabs + 详情),由悬浮/嵌入外壳共用 ----------
358
360
  function XueqiuPanel() {
@@ -789,14 +791,11 @@ export default {
789
791
  // 拖拽(贴靠状态下按下标题栏 → 解除贴靠回到自由)
790
792
  function onTitleDown(e) {
791
793
  if (e.pointerType === 'mouse' && e.button !== 0) return
794
+ dragStart = { x: e.clientX, y: e.clientY }
792
795
  if (ui.snapEdge) {
793
- const vp = viewport()
794
- if (vp) {
795
- const x = ui.snapEdge === 'right' ? vp.w - ui.snapW : 0
796
- ui.set({ snapEdge: null, pos: { x: x, y: 0 }, snap: null })
797
- } else {
798
- ui.set({ snapEdge: null, pos: { x: e.clientX - 60, y: e.clientY - 20 }, snap: null })
799
- }
796
+ // 解除贴靠:面板从按下位置转为自由,本次松手不再磁吸
797
+ ui.set({ snapEdge: null, snap: null, pos: { x: e.clientX - 30, y: e.clientY - 16 } })
798
+ suppressSnap = true
800
799
  }
801
800
  const baseX = ui.pos ? ui.pos.x : e.clientX
802
801
  const baseY = ui.pos ? ui.pos.y : e.clientY
@@ -816,15 +815,18 @@ export default {
816
815
  }
817
816
  }
818
817
  function onTitleUp(e) {
818
+ const moved = dragStart ? Math.sqrt(Math.pow(e.clientX - dragStart.x, 2) + Math.pow(e.clientY - dragStart.y, 2)) : 0
819
819
  dragRef = null
820
+ dragStart = null
820
821
  try { if (e.currentTarget.hasPointerCapture(e.pointerId)) e.currentTarget.releasePointerCapture(e.pointerId) } catch (err) { /* ignore */ }
822
+ if (suppressSnap) { suppressSnap = false; setDragTarget(null); return }
821
823
  if (dragTarget) {
822
824
  ui.set({ snapEdge: dragTarget, pos: null, snap: null, snapW: ui.snapW || 380 })
823
825
  setDragTarget(null)
824
826
  return
825
827
  }
826
828
  setDragTarget(null)
827
- snapCheck()
829
+ if (moved >= 6) snapCheck()
828
830
  }
829
831
  // 四角磁吸:拖放终点靠近任一屏幕角 → 吸附
830
832
  function snapCheck() {
@@ -903,11 +905,11 @@ export default {
903
905
  else if (ui.snapEdge === 'left') minStyle = { left: 0, top: 0, bottom: 0, width: ui.snapW, height: 'auto' }
904
906
  else if (ui.pos) minStyle = { left: ui.pos.x, top: ui.pos.y, right: 'auto', bottom: 'auto' }
905
907
  return el('div', { className: 'xq-wrap' }, [
906
- el('div', { key: 'min', className: 'xq-float xq-min' + (ui.snapEdge ? ' xq-snapped' : ''), style: minStyle, ...dragProps, onClick: function () { ui.set({ minimized: false }) } }, [
908
+ el('div', { key: 'min', className: 'xq-float xq-min' + (ui.snapEdge ? ' xq-snapped' : ''), style: minStyle, onClick: function () { ui.set({ minimized: false }) } }, [
907
909
  el('span', { key: 'logo', className: 'xq-logo' }, [el('b', { key: 'b' }, '雪球'), ' mini']),
908
910
  el('span', { key: 'sum', className: 'xq-sum' }, idxLine || '点击展开行情面板'),
909
911
  el('span', { key: 'sp', className: 'xq-spacer' }),
910
- el('button', { key: 'x', className: 'xq-btn-mini', onPointerDown: function (e) { e.stopPropagation() }, onClick: function (e) { e.stopPropagation(); ui.set({ closed: true }) } }, '✕'),
912
+ el('button', { key: 'x', className: 'xq-btn-mini', onClick: function (e) { e.stopPropagation(); ui.set({ closed: true }) } }, '✕'),
911
913
  el('span', { key: 'caret', className: 'xq-caret' }, '展开 ▾')
912
914
  ]),
913
915
  snapPreview