mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-25 01:41:48 +00:00
Merge branch 'day-20-factory' of https://github.com/thepaperpilot/Advent-Incremental into day-20-factory
This commit is contained in:
commit
33df73165b
2 changed files with 9 additions and 5 deletions
|
@ -549,8 +549,9 @@ const factory = createLayer(id, () => {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pointerDown.value &&
|
pointerDown.value &&
|
||||||
compSelected.value === "cursor" &&
|
(pointerDrag.value ||
|
||||||
(pointerDrag.value || Math.abs(e.movementX) > 2 || Math.abs(e.movementY) > 2)
|
(compSelected.value === "cursor" &&
|
||||||
|
(Math.abs(e.movementX) > 2 || Math.abs(e.movementY) > 2)))
|
||||||
) {
|
) {
|
||||||
pointerDrag.value = true;
|
pointerDrag.value = true;
|
||||||
mapOffset.x += e.movementX / blockSize;
|
mapOffset.x += e.movementX / blockSize;
|
||||||
|
@ -560,7 +561,7 @@ const factory = createLayer(id, () => {
|
||||||
mapOffset.x = Math.min(Math.max(mapOffset.x, -factorySize.width), factorySize.width);
|
mapOffset.x = Math.min(Math.max(mapOffset.x, -factorySize.width), factorySize.width);
|
||||||
mapOffset.y = Math.min(Math.max(mapOffset.y, -factorySize.height), factorySize.height);
|
mapOffset.y = Math.min(Math.max(mapOffset.y, -factorySize.height), factorySize.height);
|
||||||
}
|
}
|
||||||
if (!pointerDown.value && !pointerDrag.value && compSelected.value === "cursor") {
|
if (!pointerDown.value && !pointerDrag.value) {
|
||||||
const { tx, ty } = spriteContainer.localTransform;
|
const { tx, ty } = spriteContainer.localTransform;
|
||||||
compHovered.value =
|
compHovered.value =
|
||||||
components.value[
|
components.value[
|
||||||
|
@ -570,9 +571,12 @@ const factory = createLayer(id, () => {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onFactoryPointerDown() {
|
function onFactoryPointerDown(e: PointerEvent) {
|
||||||
window.addEventListener("pointerup", onFactoryPointerUp);
|
window.addEventListener("pointerup", onFactoryPointerUp);
|
||||||
pointerDown.value = true;
|
pointerDown.value = true;
|
||||||
|
if (e.button === 1) {
|
||||||
|
pointerDrag.value = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function onFactoryPointerUp(e: PointerEvent) {
|
function onFactoryPointerUp(e: PointerEvent) {
|
||||||
// make sure they're not dragging and that
|
// make sure they're not dragging and that
|
||||||
|
|
|
@ -448,7 +448,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
createDay(() => ({
|
createDay(() => ({
|
||||||
day: 18,
|
day: 18,
|
||||||
shouldNotify: false,
|
shouldNotify: false,
|
||||||
layer: null, // "toys2"
|
layer: "factory",
|
||||||
symbol: "",
|
symbol: "",
|
||||||
story: "",
|
story: "",
|
||||||
completedStory: "",
|
completedStory: "",
|
||||||
|
|
Loading…
Reference in a new issue