Changeset 37569 for gs3-extensions
- Timestamp:
- 2023-03-25T23:38:36+13:00 (13 months ago)
- Location:
- gs3-extensions/tabletop-dl/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/tabletop-dl/trunk/tabletop-interact.js
r37568 r37569 136 136 modifiers: [ 137 137 interact.modifiers.restrict({ 138 restriction: dragRestrictionRect, 139 140 /* 141 function(x,y,interactable_elem) { 142 //console.log(`!!! Called draggable restriction function with: x=${x}, y=${y}`); 143 144 let elem = interactable_elem.element; 145 let parent_elem = elem.parentElement; 146 //console.log("parent elem:"); 147 //console.log(parent_elem); 148 149 let parent_rect = parent_elem.getBoundingClientRect(); 150 let restrict_to_rect = { 151 left: parent_rect.left, 152 right: parent_rect.right, 153 top: parent_rect.top, 154 bottom: parent_rect.bottom 155 }; 156 157 158 let delta_xl = x - restrict_to_rect.left; 159 let delta_xr = restrict_to_rect.right - x; 160 let delta_yt = y - restrict_to_rect.top; 161 let delta_yb = restrict_to_rect.bottom - y; 162 163 let dragged_rect; 164 165 let $dragged_elem = $(elem).find('.scale-element'); 166 if ($dragged_elem.length>0) { 167 dragged_rect = $dragged_elem[0].getBoundingClientRect(); 168 } 169 else { 170 dragged_rect = elem.getBoundingClientRect(); 171 } 172 173 174 //let delta_xl = x - dragged_rect.left; 175 //let delta_xr = dragged_rect.right - x; 176 //let delta_yt = y - dragged_rect.top; 177 //let delta_yb = dragged_rect.bottom - y; 178 179 //console.log(dragged_rect); 180 //console.log("restrict to:"); 181 //console.log(restrict_to_rect); 182 183 // test bounds of dragged_rect, to restrict_to_rect 184 // factor in any overshoots in the encoded rect returned 185 186 if ((dragged_rect.left >= restrict_to_rect.left) || (dragged_rect.right <= restrict_to_rect.right)) { 187 // want to avoid situation where for dragged_rect both left and right are 188 // outside of the restrict_to_rect 189 190 if (dragged_rect.left < restrict_to_rect.left) { 191 // encode how much the overshoot it 192 restrict_to_rect.left += (restrict_to_rect.left - dragged_rect.left); 193 194 // Now factor in the offset that comes from the supplied (x,y); 195 restrict_to_rect.left += (x - parent_rect.left); 196 restrict_to_rect.right += (x - parent_rect.left); 197 198 } 199 if (dragged_rect.right > restrict_to_rect.right) { 200 // encode how much the overshoot it 201 restrict_to_rect.right -= (dragged_rect.right - restrict_to_rect.right); 202 203 // Now factor in the offset that comes from the supplied (x,y); 204 restrict_to_rect.left -= (parent_rect.right - x) + 1; 205 restrict_to_rect.right -= (parent_rect.right - x) + 1; 206 207 } 208 } 209 if ((dragged_rect.top >= restrict_to_rect.top) || (dragged_rect.bottom <= restrict_to_rect.bottom)) { 210 // want to avoid situation where for dragged_rect both left and right are 211 // outside of the restrict_to_rect 212 213 if (dragged_rect.top < restrict_to_rect.top) { 214 // encode how much the overshoot it 215 restrict_to_rect.top += (restrict_to_rect.top - dragged_rect.top); 216 217 // Now factor in the offset that comes from the supplied (x,y); 218 restrict_to_rect.top += (y - parent_rect.top); 219 restrict_to_rect.bottom += (y - parent_rect.top); 220 } 221 if (dragged_rect.bottom > restrict_to_rect.bottom) { 222 // encode how much the overshoot it 223 restrict_to_rect.bottom -= (dragged_rect.bottom - restrict_to_rect.bottom); 224 225 // Now factor in the offset that comes from the supplied (x,y); 226 restrict_to_rect.top -= (parent_rect.bottom - y) + 1; 227 restrict_to_rect.bottom -= (parent_rect.bottom - y) + 1; 228 229 } 230 } 231 232 //restrict_to_rect.x = restrict_to_rect.left; 233 //restrict_to_rect.width = restrict_to_rect.right - restrict_to_rect.left + 1; 234 235 //restrict_to_rect.y = restrict_to_rect.top; 236 //restrict_to_rect.height = restrict_to_rect.bottom - restrict_to_rect.top + 1; 237 238 //console.log(`Returning for (${x},${y}) as delta [xl<->xr],[yt,<->yb] [(${delta_xl}<->${delta_xr}],[${delta_yt})<->${delta_yb}]`); 239 //console.log(restrict_to_rect); 240 241 return restrict_to_rect; 242 },*/ 243 138 restriction: dragRestrictionRect, 244 139 endOnly: true 245 140 }), … … 267 162 listeners: { 268 163 269 moveNEWER : function (event) {164 moveNEWER_UNUSED: function (event) { 270 165 let { x, y } = event.target.dataset 271 166 … … 335 230 336 231 337 function getCoreGesturableOptions(elem,angleScale) 232 //function getCoreGesturableOptions(elem,angleScale) 233 function getCoreGesturableOptions(elem) 338 234 { 235 //let elem_angle_scale = { 236 let angleScale = { 237 angle: 0, 238 scale: 1 239 }; 240 339 241 let core_gesturable_options = { 340 242 listeners: { … … 371 273 // https://codepen.io/bxchang04/pen/XWmWbZQ 372 274 275 /* 373 276 $(document).ready(function() { 374 277 … … 387 290 388 291 let this_elem = this; 389 390 let this_angle_scale = { 391 angle: 0, 392 scale: 1 393 } 292 293 294 //let this_angle_scale = { 295 // angle: 0, 296 // scale: 1 297 //} 298 394 299 395 300 let gdraggable_options = getCoreDraggableOptions(); 396 let gesturable_options = getCoreGesturableOptions(this_elem ,this_angle_scale);301 let gesturable_options = getCoreGesturableOptions(this_elem);//this_angle_scale); 397 302 398 303 interact(this_elem) … … 402 307 }); 403 308 }); 309 */ 404 310 405 311 … … 417 323 x: 80, 418 324 y: 90, 419 width: "4 65px",325 width: "475px", 420 326 height: "585px", 421 327 border: "0.3em", … … 484 390 485 391 let this_elem = document.getElementById('my-winbox2'); 486 392 393 /* 487 394 let this_angle_scale = { 488 395 angle: 0, 489 396 scale: 1 490 397 }; 491 398 */ 492 399 493 400 let gdraggable_options = getCoreDraggableOptions(); 494 let gesturable_options = getCoreGesturableOptions(this_elem ,this_angle_scale);401 let gesturable_options = getCoreGesturableOptions(this_elem/*,this_angle_scale*/); 495 402 496 403 var my_winbox2 = interact('#my-winbox2') -
gs3-extensions/tabletop-dl/trunk/tabletop.css
r37559 r37569 61 61 #gs-control-bar { 62 62 position: absolute; 63 z-index: 5;63 z-index: 20; 64 64 height: 2.5rem; 65 65 color: var(--gs-fg-primary-col); … … 70 70 71 71 #gs-control-bar-toggle { 72 z-index: 6;72 z-index: 21; 73 73 position: absolute; 74 74 left: 0px; 75 75 top: 0px; 76 background-color: var(--gs-bg-primary-col); 77 padding: 0.8rem; 78 } 76 /*background-color: var(--gs-bg-primary-col); */ 77 background-color: #fff; 78 color: #000; 79 padding: 0.6rem 0.9rem 0.6rem 0.9rem; 80 } 81 82 #gs-home-open { 83 z-in4dex: 21; 84 position: absolute; 85 left: 0px; 86 bottom: 0px; 87 /* background-color: var(--gs-bg-primary-col); */ 88 background-color: #fff; 89 padding: 0.5rem; 90 } 91 79 92 80 93 -
gs3-extensions/tabletop-dl/trunk/tabletop.xsl
r37559 r37569 77 77 <!--<xsl:call-template name="displayErrorsIfAny"/>--> 78 78 79 <!--80 <div id="gs_content" class="ui-widget-content">81 <xsl:apply-templates select="/page" />82 </div>83 -->84 85 79 86 80 <div class="box"> 81 <!-- currently not used --> 87 82 <div id="gs-control-bar_ORIG" class="row header" style="display: none;"> 88 83 <div style="padding-top: 0.6em;">Greenstone Tabletop Digital Library</div> 89 84 </div> 85 90 86 <div class="row content" style="margin: 0.5em;"> 91 87 … … 95 91 <div style="padding-top: 0.6em;">Greenstone Tabletop Digital Library</div> 96 92 </div> 97 <div id="gs-control-bar-toggle" class="button" onclickXXX="gsToggleHeader()">☰</div> 98 99 100 <div id="gesture-area" class="drag-and-zoom" 101 style="position: absolute; left: 700px; top: 30px; width: 576px; height: 384px;"> 102 <img class="info-window scale-element" src="ext/tabletop-dl/backgrounds/unsplash--matrix-like-binary.jpg" 103 style="width: 576px; height: 384px" 104 id="scale-element" /> 93 <div id="gs-control-bar-toggle" class="button">☰</div> 94 <div id="gs-home-open" class="button"> 95 <img src="interfaces/{$interface_name}/images/logo-icons/32/server32.png" width="32" height="32"/> 105 96 </div> 106 107 <div id="info-window-id" class="info-window resize-drag" 108 style="position: absolute; left: 100px; top: 60px; width: 400px;"> 109 <p class="interact-info-bar">Info:</p> 110 <p> You can Drag and Resize this element </p> 111 <p>Goto <a target="_blank" href="https://greenstone.org/">Greenstone3 Project Home Page</a></p> 112 <p> 113 <form> 114 <input type="text" /> 115 </form> 116 </p> 117 </div> 118 119 <div class="drag-and-zoom" 120 style="position: absolute; left: 300px; top: 430px; width: 400px;"> 121 <div class="info-window scale-element" style="width: 100%"> 122 <p>You can Drag and Zoom this element </p> 123 <p>Goto <a href="https://greenstone.org/">Greenstone3 Project Home Page</a></p> 124 <p> 125 <form> 126 <input type="text" /> 127 </form> 128 </p> 129 </div> 130 </div> 131 97 132 98 </div> 133 99 … … 140 106 141 107 </div> 108 109 <!-- currently not used --> 142 110 <div class="row footer" style="display:none;"> 143 111 <p>footer (fixed height)</p>
Note:
See TracChangeset
for help on using the changeset viewer.