btc-wallet 0.5.57-beta → 0.5.58-beta

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/esm/index.js CHANGED
@@ -4448,7 +4448,20 @@ function createFloatingButtonWithIframe({
4448
4448
  let startY = 0;
4449
4449
  let initialRight = 0;
4450
4450
  let initialBottom = 0;
4451
- let dragStartTime = 0;
4451
+ let isLongPress = false;
4452
+ button.addEventListener(
4453
+ "click",
4454
+ (e) => {
4455
+ if (isLongPress) {
4456
+ isLongPress = false;
4457
+ return;
4458
+ }
4459
+ handleButtonClick();
4460
+ e.preventDefault();
4461
+ e.stopPropagation();
4462
+ },
4463
+ { capture: true }
4464
+ );
4452
4465
  const handleMouseDown = (e) => {
4453
4466
  startDrag(e.clientX, e.clientY);
4454
4467
  e.preventDefault();
@@ -4470,13 +4483,17 @@ function createFloatingButtonWithIframe({
4470
4483
  startY = clientY;
4471
4484
  initialRight = parseInt(button.style.right);
4472
4485
  initialBottom = parseInt(button.style.bottom);
4473
- dragStartTime = Date.now();
4474
4486
  button.style.cursor = "grabbing";
4475
4487
  button.style.transition = "none";
4476
4488
  }
4477
4489
  const handleMouseMove = (e) => {
4478
4490
  if (!isDragging)
4479
4491
  return;
4492
+ const deltaX = Math.abs(startX - e.clientX);
4493
+ const deltaY = Math.abs(startY - e.clientY);
4494
+ if (deltaX > 5 || deltaY > 5) {
4495
+ isLongPress = true;
4496
+ }
4480
4497
  moveButton(e.clientX, e.clientY);
4481
4498
  e.preventDefault();
4482
4499
  e.stopPropagation();
@@ -4485,6 +4502,11 @@ function createFloatingButtonWithIframe({
4485
4502
  if (!isDragging || e.touches.length !== 1)
4486
4503
  return;
4487
4504
  const touch = e.touches[0];
4505
+ const deltaX = Math.abs(startX - touch.clientX);
4506
+ const deltaY = Math.abs(startY - touch.clientY);
4507
+ if (deltaX > 5 || deltaY > 5) {
4508
+ isLongPress = true;
4509
+ }
4488
4510
  moveButton(touch.clientX, touch.clientY);
4489
4511
  e.preventDefault();
4490
4512
  e.stopPropagation();
@@ -4534,8 +4556,6 @@ function createFloatingButtonWithIframe({
4534
4556
  function endDrag() {
4535
4557
  if (!isDragging)
4536
4558
  return;
4537
- const dragEndTime = Date.now();
4538
- const isDragEvent = dragEndTime - dragStartTime > 200;
4539
4559
  isDragging = false;
4540
4560
  button.style.cursor = "grab";
4541
4561
  button.style.transition = "transform 0.15s ease";
@@ -4543,9 +4563,6 @@ function createFloatingButtonWithIframe({
4543
4563
  right: button.style.right,
4544
4564
  bottom: button.style.bottom
4545
4565
  });
4546
- if (!isDragEvent) {
4547
- handleButtonClick();
4548
- }
4549
4566
  }
4550
4567
  const handleButtonClick = () => {
4551
4568
  const isCurrentlyVisible = iframe.style.display === "block";
@@ -5099,7 +5116,7 @@ function getGroup(state) {
5099
5116
 
5100
5117
  // src/index.ts
5101
5118
  var getVersion = () => {
5102
- return "0.5.57-beta";
5119
+ return "0.5.58-beta";
5103
5120
  };
5104
5121
  if (typeof window !== "undefined") {
5105
5122
  window.__BTC_WALLET_VERSION = getVersion();