Skip to content

Commit

Permalink
fix: for undefined set and id (binary-com#16360)
Browse files Browse the repository at this point in the history
  • Loading branch information
rupato-deriv committed Aug 6, 2024
1 parent fffe035 commit 8a6161b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/bot-skeleton/src/scratch/hooks/workspace_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Blockly.WorkspaceSvg.prototype.centerOnBlock = function (id, hideChaff = true) {
Blockly.hideChaff();
}

this.scrollbar.set(scrollToCenterX, scrollToCenterY);
this?.scrollbar?.set(scrollToCenterX, scrollToCenterY);
};

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/bot-skeleton/src/scratch/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,16 +458,16 @@ export const scrollWorkspace = (workspace, scroll_amount, is_horizontal, is_chro
*/

if (window.innerWidth < 768) {
workspace.scrollbar.set(0, scroll_y);
workspace?.scrollbar?.set(0, scroll_y);
const calc_scroll =
workspace.svgBlockCanvas_?.getBoundingClientRect().width -
workspace.svgBlockCanvas_?.getBoundingClientRect().left +
60;
workspace.scrollbar.set(calc_scroll, scroll_y);
workspace?.scrollbar?.set(calc_scroll, scroll_y);
return;
}
}
workspace.scrollbar.set(scroll_x, scroll_y);
workspace?.scrollbar?.set(scroll_x, scroll_y);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-web-ui/src/stores/app-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default class AppStore {
.filter(block => block.type === 'trade_definition_market')
.forEach(block => {
runIrreversibleEvents(() => {
const fake_create_event = new window.Blockly.Events.BlockCreate(this);
const fake_create_event = new window.Blockly.Events.BlockCreate(block);
window.Blockly.Events.fire(fake_create_event);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-web-ui/src/stores/toolbox-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default class ToolboxStore {
const workspace_metrics = workspace.getMetrics();
const block_canvas_space =
workspace_metrics.scrollWidth + workspace_metrics.viewLeft - workspace_metrics.viewWidth;
workspace.scrollbar.set(block_canvas_space, scroll_y);
workspace?.scrollbar?.set(block_canvas_space, scroll_y);
}
}
}
Expand Down

0 comments on commit 8a6161b

Please sign in to comment.