You are not logged in.

1

Monday, March 20th 2023, 12:02pm

How to scroll html in plugin?

I created a plugin to show modal when clicking on hotspot , by passing in html but I can't use the scroll wheel to move the content of the html , it only changes the zoom, I tried giving the plugin a value onhover_autoscrolling= "false" but still not working *confused*
*thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

kme

Intermediate

Posts: 264

Location: Belgium

Occupation: Long time coder, product manager and 3D enthousiast

  • Send private message

2

Monday, March 20th 2023, 1:16pm

I created a plugin to show modal when clicking on hotspot , by passing in html but I can't use the scroll wheel to move the content of the html , it only changes the zoom, I tried giving the plugin a value onhover_autoscrolling= "false" but still not working *confused*

Can you share some code on how you create the "modal" ?

3

Monday, March 20th 2023, 2:23pm

I created a plugin to show modal when clicking on hotspot , by passing in html but I can't use the scroll wheel to move the content of the html , it only changes the zoom, I tried giving the plugin a value onhover_autoscrolling= "false" but still not working *confused*

Can you share some code on how you create the "modal" ?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
function krpanoplugin(){
    var local = this;   // save the 'this' pointer from the current plugin object

    var krpano = null;  // the krpano and plugin interface objects
    var plugin = null;

    var xml_value = 100.0;   // the value for a custom xml attribute

    // registerplugin - startup point for the plugin (required)
    // - krpanointerface = krpano interface object
    // - pluginpath = the fully qualified plugin name (e.g. "plugin[name]")
    // - pluginobject = the xml plugin object itself
    local.registerplugin = function(krpanointerface, pluginpath, pluginobject)
    {
        // get the krpano interface and the plugin object
        krpano = krpanointerface;
        plugin = pluginobject;


 

        // optionally - add some graphical content:

        // register the size of the content
        plugin.width = "100%";
plugin.height = "100%";plugin.align = "center"
        // use 100% width/height for automatic scaling with the plugin size
        var text = document.createElement("div");
        text.style.cssText = "width:100%;height:100%;"+
            "display:flex;color:white;background:rgba(10,50,100,0.5);"+
            "align-items:center;justify-content:center;text-align:center;";
        text.innerHTML = `<div id="myModal" class="modal">
		
		<div class= "container-fluid">
			
			<div class ="row" id ="content-3d">
				<span class="close" id="close1">&times;</span>
				<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
		<!-- Modal content -->
		<div class="modal-content" id="modal-content">
			<div id="model-viewer">
			</div>
		</div>
				</div>
				<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
					<div class="box">
		<div id="table" class="infoTable">
			<!-- Modal content -->
			<div class="modal-table">
				<div id="model-viewer">
					<div id="info" class="display" style="width:100%">
						<div>
							<div style="margin: 10px 0px;font-size: 18px;color: rgb(255 255 255);display: block;background-color: #80808075;font-weight: 500;padding: 5px;">Tên sản phẩm: </div><span
								id="info-name">Unknown</span>
							<div id = "gioithieu" style="margin: 10px 0px;font-size: 18px;color: rgb(255 255 255);display: block;background-color: #80808075;font-weight: 500;padding: 5px;">Giới thiệu: </div><span
								id="info-features">Unknown</span>
							<div id ="thanhphan" style="margin: 10px 0px;font-size: 18px;color: rgb(255 255 255);display: block;background-color: #80808075;font-weight: 500;padding: 5px;">Thành phần: </div>
							<span id="info-specs">Unknown</span>
							<div id="luuy" style="margin: 10px 0px;font-size: 18px;color: rgb(255 255 255);display: block;background-color: #80808075;font-weight: 500;padding: 5px;">Thông tin khác: </div><span
								id="info-warning">Unknown</span>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	</div>
	</div>
	</div>
</div>`;

        // the plugin 'sprite' variable is the internal html element of the plugin
        plugin.sprite.appendChild(text);
    }

    // unloadplugin - exit point for the plugin (optionally)
    // - will be called from krpano when the plugin will be removed
    // - everything that was added by the plugin should be removed here
    local.unloadplugin = function()
    {
        plugin = null;
        krpano = null;
    }

    // onresize (optionally)
    // - width,height = the new size for the plugin
    // - when not defined then only the krpano plugin html element will be sized
    local.onresize = function(width,height)
    {
        // not used in this example
        // the plugin content will resize automatically because
        // of the width=100%, height=100% CSS style
        return false;
    }

  



     }
*thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

4

Monday, March 20th 2023, 2:25pm

in tour.xml file

Source code

1
<plugin name ="modal" visible ="false" url ="modal.js" keep ="true">
*rolleyes*
*thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

kme

Intermediate

Posts: 264

Location: Belgium

Occupation: Long time coder, product manager and 3D enthousiast

  • Send private message

5

Monday, March 20th 2023, 2:51pm

The setting onhover_autoscrolling= "false" is only for the scrollarea plugin (https://krpano.com/plugins/scrollarea/) Since you created your own plugin, you need to handle this yourself.

You can disable scrolling by setting the "disablewheel" of the control to true.
https://krpano.com/docu/xml/#control.disablewheel

krpano action code:

Source code

1
set(control.disablewheel, true);


And you can set it to false again when hiding the dialog.

gr,
kme
.

6

Tuesday, March 21st 2023, 2:33am

The setting onhover_autoscrolling= "false" is only for the scrollarea plugin (https://krpano.com/plugins/scrollarea/) Since you created your own plugin, you need to handle this yourself.

You can disable scrolling by setting the "disablewheel" of the control to true.
https://krpano.com/docu/xml/#control.disablewheel

krpano action code:

Source code

1
set(control.disablewheel, true);


And you can set it to false again when hiding the dialog.

gr,
kme
.
thank you very much, it's work
*thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

7

Tuesday, March 21st 2023, 3:43am

*love*
*thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

This post has been edited 2 times, last edit by "yenph" (Mar 21st 2023, 5:05am)


8

Tuesday, March 21st 2023, 2:04pm

Hi,

I would recommend using the built-in HTML layer (type="html"):
https://krpano.com/docu/xml/#layer.type

There the scrolling can be controlled using the htmloverflow setting and mouse and touch is automatically supported:
https://krpano.com/docu/xml/#layer.htmloverflow

Best regards,
Klaus