From 13ea2a4879c7eb709a30a5e6917dc125fe89260d Mon Sep 17 00:00:00 2001 From: varshneydevansh Date: Fri, 28 Jul 2023 17:52:54 +0530 Subject: [PATCH 1/3] fix: removed X & Y from toolbox.ts and replaced movBy to moveTo in Horizontal/ Vertical flyout --- core/flyout_horizontal.ts | 17 +++++++++-------- core/flyout_vertical.ts | 21 ++++++++++++--------- core/utils/toolbox.ts | 2 -- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/core/flyout_horizontal.ts b/core/flyout_horizontal.ts index ad27ca1dcf5..20a1c3ff3f2 100644 --- a/core/flyout_horizontal.ts +++ b/core/flyout_horizontal.ts @@ -14,13 +14,13 @@ goog.declareModuleId('Blockly.HorizontalFlyout'); import * as browserEvents from './browser_events.js'; import * as dropDownDiv from './dropdowndiv.js'; -import {Flyout, FlyoutItem} from './flyout_base.js'; -import type {FlyoutButton} from './flyout_button.js'; -import type {Options} from './options.js'; +import { Flyout, FlyoutItem } from './flyout_base.js'; +import type { FlyoutButton } from './flyout_button.js'; +import type { Options } from './options.js'; import * as registry from './registry.js'; -import {Scrollbar} from './scrollbar.js'; -import type {Coordinate} from './utils/coordinate.js'; -import {Rect} from './utils/rect.js'; +import { Scrollbar } from './scrollbar.js'; +import { Coordinate } from './utils/coordinate.js'; +import { Rect } from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -41,7 +41,7 @@ export class HorizontalFlyout extends Flyout { * @param xyRatio Contains a y property which is a float between 0 and 1 * specifying the degree of scrolling and a similar x property. */ - protected override setMetrics_(xyRatio: {x: number; y: number}) { + protected override setMetrics_(xyRatio: { x: number; y: number }) { if (!this.isVisible()) { return; } @@ -285,7 +285,8 @@ export class HorizontalFlyout extends Flyout { } else { moveX = cursorX - tab; } - block!.moveBy(moveX, cursorY); + // No 'reason' provided since events are disabled. + block!.moveTo(new Coordinate(moveX, cursorY)); const rect = this.createRect_(block!, moveX, cursorY, blockHW, i); cursorX += blockHW.width + gaps[i]; diff --git a/core/flyout_vertical.ts b/core/flyout_vertical.ts index d0c4a5d585e..4b7b1643298 100644 --- a/core/flyout_vertical.ts +++ b/core/flyout_vertical.ts @@ -14,13 +14,13 @@ goog.declareModuleId('Blockly.VerticalFlyout'); import * as browserEvents from './browser_events.js'; import * as dropDownDiv from './dropdowndiv.js'; -import {Flyout, FlyoutItem} from './flyout_base.js'; -import type {FlyoutButton} from './flyout_button.js'; -import type {Options} from './options.js'; +import { Flyout, FlyoutItem } from './flyout_base.js'; +import type { FlyoutButton } from './flyout_button.js'; +import type { Options } from './options.js'; import * as registry from './registry.js'; -import {Scrollbar} from './scrollbar.js'; -import type {Coordinate} from './utils/coordinate.js'; -import {Rect} from './utils/rect.js'; +import { Scrollbar } from './scrollbar.js'; +import { Coordinate } from './utils/coordinate.js'; +import { Rect } from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -42,7 +42,7 @@ export class VerticalFlyout extends Flyout { * @param xyRatio Contains a y property which is a float between 0 and 1 * specifying the degree of scrolling and a similar x property. */ - protected override setMetrics_(xyRatio: {x: number; y: number}) { + protected override setMetrics_(xyRatio: { x: number; y: number }) { if (!this.isVisible()) { return; } @@ -246,7 +246,8 @@ export class VerticalFlyout extends Flyout { const moveX = block!.outputConnection ? cursorX - this.tabWidth_ : cursorX; - block!.moveBy(moveX, cursorY); + // No 'reason' provided since events are disabled. + block!.moveTo(new Coordinate(moveX, cursorY)); const rect = this.createRect_( block!, @@ -357,7 +358,8 @@ export class VerticalFlyout extends Flyout { if (!block.outputConnection) { newX -= this.tabWidth_; } - block.moveBy(newX - oldX, 0); + // No 'reason' provided since events are disabled. + block.moveTo(new Coordinate(newX - oldX, 0)); } if (this.rectMap_.has(block)) { this.moveRectToBlock_(this.rectMap_.get(block)!, block); @@ -372,6 +374,7 @@ export class VerticalFlyout extends Flyout { button.width - this.MARGIN - this.tabWidth_; + // No 'reason' provided since events are disabled. button.moveTo(x, y); } } diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index b2d71e3b6fe..c192d40792c 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -24,8 +24,6 @@ export interface BlockInfo { disabled?: string | boolean; enabled?: boolean; id?: string; - x?: number; - y?: number; collapsed?: boolean; inline?: boolean; data?: string; From e147ab30c64f1fa740f329e20e20d5c2ac035e6f Mon Sep 17 00:00:00 2001 From: varshneydevansh Date: Fri, 28 Jul 2023 17:55:58 +0530 Subject: [PATCH 2/3] forget to run npm lint and format --- core/flyout_horizontal.ts | 14 +++++++------- core/flyout_vertical.ts | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/flyout_horizontal.ts b/core/flyout_horizontal.ts index 20a1c3ff3f2..019570493c3 100644 --- a/core/flyout_horizontal.ts +++ b/core/flyout_horizontal.ts @@ -14,13 +14,13 @@ goog.declareModuleId('Blockly.HorizontalFlyout'); import * as browserEvents from './browser_events.js'; import * as dropDownDiv from './dropdowndiv.js'; -import { Flyout, FlyoutItem } from './flyout_base.js'; -import type { FlyoutButton } from './flyout_button.js'; -import type { Options } from './options.js'; +import {Flyout, FlyoutItem} from './flyout_base.js'; +import type {FlyoutButton} from './flyout_button.js'; +import type {Options} from './options.js'; import * as registry from './registry.js'; -import { Scrollbar } from './scrollbar.js'; -import { Coordinate } from './utils/coordinate.js'; -import { Rect } from './utils/rect.js'; +import {Scrollbar} from './scrollbar.js'; +import {Coordinate} from './utils/coordinate.js'; +import {Rect} from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -41,7 +41,7 @@ export class HorizontalFlyout extends Flyout { * @param xyRatio Contains a y property which is a float between 0 and 1 * specifying the degree of scrolling and a similar x property. */ - protected override setMetrics_(xyRatio: { x: number; y: number }) { + protected override setMetrics_(xyRatio: {x: number; y: number}) { if (!this.isVisible()) { return; } diff --git a/core/flyout_vertical.ts b/core/flyout_vertical.ts index 4b7b1643298..058a4d90de8 100644 --- a/core/flyout_vertical.ts +++ b/core/flyout_vertical.ts @@ -14,13 +14,13 @@ goog.declareModuleId('Blockly.VerticalFlyout'); import * as browserEvents from './browser_events.js'; import * as dropDownDiv from './dropdowndiv.js'; -import { Flyout, FlyoutItem } from './flyout_base.js'; -import type { FlyoutButton } from './flyout_button.js'; -import type { Options } from './options.js'; +import {Flyout, FlyoutItem} from './flyout_base.js'; +import type {FlyoutButton} from './flyout_button.js'; +import type {Options} from './options.js'; import * as registry from './registry.js'; -import { Scrollbar } from './scrollbar.js'; -import { Coordinate } from './utils/coordinate.js'; -import { Rect } from './utils/rect.js'; +import {Scrollbar} from './scrollbar.js'; +import {Coordinate} from './utils/coordinate.js'; +import {Rect} from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -42,7 +42,7 @@ export class VerticalFlyout extends Flyout { * @param xyRatio Contains a y property which is a float between 0 and 1 * specifying the degree of scrolling and a similar x property. */ - protected override setMetrics_(xyRatio: { x: number; y: number }) { + protected override setMetrics_(xyRatio: {x: number; y: number}) { if (!this.isVisible()) { return; } From ceb6489db9dc6cd039947bf0fb9a52015fd6c458 Mon Sep 17 00:00:00 2001 From: varshneydevansh Date: Sat, 29 Jul 2023 00:07:27 +0530 Subject: [PATCH 3/3] removed the mistakenly added comment --- core/flyout_vertical.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/core/flyout_vertical.ts b/core/flyout_vertical.ts index 058a4d90de8..9dac14d7313 100644 --- a/core/flyout_vertical.ts +++ b/core/flyout_vertical.ts @@ -374,7 +374,6 @@ export class VerticalFlyout extends Flyout { button.width - this.MARGIN - this.tabWidth_; - // No 'reason' provided since events are disabled. button.moveTo(x, y); } }