Skip to content

Commit 4585963

Browse files
committed
pan to center on init
1 parent 40df267 commit 4585963

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Controls.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class Controls {
155155
background.tileScale.set(scale);
156156
});
157157

158-
select<Element, unknown>("canvas")
158+
const selection = select<Element, unknown>("canvas")
159159
.call(zoomHandler)
160160
.on("dblclick.zoom", null)
161161
.on("click", () => {
@@ -174,6 +174,8 @@ export class Controls {
174174
.on("contextmenu", (_event: MouseEvent) => {
175175
Controls.flag();
176176
});
177+
178+
zoomHandler.translateTo(selection, 0, 0);
177179
}
178180

179181
// todo create method on the parent which applies transform instead of mutating the object directly.

0 commit comments

Comments
 (0)