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

Dragging hotspot #1182

Open
hendrialqori opened this issue Oct 18, 2023 · 1 comment
Open

Dragging hotspot #1182

hendrialqori opened this issue Oct 18, 2023 · 1 comment
Labels

Comments

@hendrialqori
Copy link

Hello @mpetroff 

Is there an example of how to make hotspot draggable? I have read doc/json-config-parameters.md but it does not work for me.

Thank you in advance.

@mpetroff
Copy link
Owner

Here's an example:

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hot spots</title>
    <link rel="stylesheet" href="../src/css/pannellum.css"/>
    <script type="text/javascript" src="../src/js/pannellum.js"></script>
    <script type="text/javascript" src="../src/js/libpannellum.js"></script>
    <style>
    #panorama {
        width: 600px;
        height: 400px;
    }
    </style>
</head>
<body>

<div id="panorama"></div>
<script>
function dragHandler(event, args) {
    console.log(event, args);
}

pannellum.viewer('panorama', {
    "type": "equirectangular",
    "panorama": "examplepano.jpg",
    "hotSpots": [
        {
            "pitch": 14.1,
            "yaw": 1.5,
            "type": "info",
            "text": "Example",
            "draggable": true,
            "dragHandlerFunc": dragHandler,
            "dragHandlerArgs": "example arg"
        },
    ]
});
</script>

</body>
</html>

Note that this was added after v2.5.6 was released, so you need to use the Git master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants