Skip to content

Commit b6763aa

Browse files
author
hartsantler
committed
dddom.py: testing checkbox, and darkstrap.css dropdown button.
1 parent a7a0c78 commit b6763aa

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

regtests/html/dddom.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,39 @@ def func(): ta.focus() ## this allows normal keyboard input
1515
ta.setAttribute('class', 'focused alert alert-info')
1616
return ta
1717

18+
def create_checkbox( checked ):
19+
## no special hacks required for checkboxes ##
20+
c = document.createElement('input')
21+
c.setAttribute('type', 'checkbox')
22+
if checked: c.setAttribute('checked', 'true')
23+
return c
24+
25+
def create_dropdown_button( name, options ):
26+
div = document.createElement('div')
27+
div.setAttribute('class', 'btn-group')
28+
29+
b = document.createElement('button')
30+
b.setAttribute('class', 'btn dropdown-toggle')
31+
b.setAttribute('data-toggle', 'dropdown')
32+
caret = document.createElement('span')
33+
caret.setAttribute('class', 'caret')
34+
b.appendChild( document.createTextNode(name))
35+
b.appendChild(caret)
36+
37+
## the darkstrap css fails to properly expand the options,
38+
## TODO - fix darkstrap or convert this to a 3D dropdown.
39+
ul = document.createElement('ul')
40+
ul.setAttribute('class', 'dropdown-menu')
41+
for opt in options:
42+
li = document.createElement('li')
43+
a = document.createElement('a')
44+
a.appendChild( document.createTextNode(opt) )
45+
li.appendChild( a )
46+
ul.appendChild( li )
47+
48+
div.appendChild(b)
49+
div.appendChild(ul)
50+
return div
1851

1952
CLICKABLES = []
2053
def _on_mouse_up(evt):

regtests/html/webgl_css3d_simple_editor.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@
195195
this.setAttribute('class', 'btn btn-warning btn-small')
196196
this.parentNode.appendChild(document.createTextNode(' mode:'))
197197
this.parentNode.appendChild( this.element3D.create_select_dropdown(test_options) )
198+
199+
this.parentNode.appendChild( document.createTextNode('mycheckbox:') )
200+
this.parentNode.appendChild( create_checkbox(true) )
201+
202+
this.parentNode.appendChild( create_dropdown_button('drop-button'), ['my-opt1', 'my-opt2', 'my-opt3'] )
203+
198204
this.parentNode.appendChild(document.createElement('br'))
199205

200206
con = document.createElement('div')
@@ -249,7 +255,7 @@
249255
renderer3.setSize( window.innerWidth, window.innerHeight );
250256
renderer3.domElement.style.position = 'absolute';
251257
renderer3.domElement.style.top = 0;
252-
renderer3.domElement.style.opacity = 0.28;
258+
renderer3.domElement.style.opacity = 0.08;
253259
renderer3.domElement.style.zIndex=200;
254260

255261
document.body.appendChild( renderer2.domElement );

0 commit comments

Comments
 (0)