Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add holding as reactive property #211

Merged
merged 7 commits into from
Mar 9, 2023

Conversation

malangfox
Copy link
Contributor

Details

Added a new reactive property holding, available in vanilla and all frameworks.
holding returns true if at least one input is in progress, such as pressing a mouse button or pressing a key.

Example for react-axes

import React, { useEffect, useRef } from "react";
import { useAxes, PanInput } from "@egjs/react-axes";

export default function Demo() {
  const { x, connect, holding } = useAxes(
    {
      x: {
        range: [0, 360],
        circular: true,
      },
    },
  );

  useEffect(() => {
    connect("x", new PanInput("#area"));
  }, []);

  return (
    <div id="area">
      /* Do something with using {holding} */
    </div>
  );
};

Copy link
Member

@daybrush daybrush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@WoodNeck WoodNeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@malangfox malangfox merged commit 96ec136 into naver:master Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants