Changeset 37559


Ignore:
Timestamp:
2023-03-23T23:41:37+13:00 (13 months ago)
Author:
davidb
Message:

Series of changes that improve the overall interactive and visual display of zooming/rotating

Location:
gs3-extensions/tabletop-dl/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/tabletop-dl/trunk/tabletop-interact.js

    r37555 r37559  
    4040}
    4141
    42 // http://localhost:8383/greenstone3/library
    43 
    4442function getCoreResizableOptions()
    4543{
    4644    let core_resizable_options = {
    47    
    48     edges: { left: true, right: true, bottom: true, top: true },
     45
     46    preserveAspectRatio: false,
     47    edges: { left: true, right: true, bottom: true, top: false },
    4948       
    5049    listeners: {
     
    249248        const winbox1 = new WinBox({
    250249        id:    "my-winbox1",
    251         title: 'Winbox + Interact Example 1',
    252         x: 200,
    253         y: 200,
    254         width: '900px',
    255         height: '400px',
     250        title: 'Winbox + Interact Example: Drag and Resize',
     251        x:  80,
     252        y: 90,
     253        width:  "465px",
     254        height: "585px",
    256255        border: "0.3em",
    257256        background: "#29e",
     
    262261        $('#my-winbox1 .wb-header').css("user-select", "none");
    263262        $('#my-winbox1 .wb-header').css("touch-action","none");
     263
     264        $('#my-winbox1 .wb-body').addClass("winbox-info-window");
    264265       
    265266        let draggable_options = getCoreDraggableOptions();
     
    275276
    276277
    277     const win2 = new WinBox({
    278     id:    "my-winbox2",
    279     title: 'Winbox + Interact Example 2',
    280     x: 800,
    281     y: 200,
    282     width: '500px',
    283     height: '300px',
    284     border: "0.3em",
    285     background: "#29e",
    286     html: "<p classXXX=\"scale-element\" style=\"padding: 8px; color: #000;\">This window can be dragged around, rotated and zoomed in and out</p>"
    287     });
    288 
    289     // user-select: none;
    290     // touch-action: none;
    291    
    292     let $win2 = $('#my-winbox2');
    293     let $scale_element_div = $('<div>').attr("class","scale-element");
    294     $scale_element_div.append($win2.children()).clone();
    295    
    296     $win2.empty().append($scale_element_div);
    297    
    298    
    299    
    300     /*
    301     interact('#my-winbox2')
    302     .draggable(draggable_options)
    303     .resizable(resizable_options);
    304     */
    305 
    306     let this_elem = document.getElementById('my-winbox2');
    307    
    308     let this_angle_scale = {
    309     angle: 0,
    310     scale: 1
    311     }
    312    
    313    
    314     let gdraggable_options = getCoreDraggableOptions();
    315     let gesturable_options = getCoreGesturableOptions(this_elem,this_angle_scale);
    316    
    317     interact('#my-winbox2')
    318     .gesturable(gesturable_options)
    319     .draggable(gdraggable_options);
    320    
    321    
     278
     279    let doc_url = "http://localhost:8383/greenstone3/library/collection/gs2mgdemo/document/HASHe3aae2159b0dda6553cee4";
     280
     281    $.ajax({
     282    url: doc_url,
     283    data: {
     284        "excerptid": "gs_content",
     285        "ed": "1"
     286    }
     287    })
     288    .done(function(html_result) {
     289
     290       
     291        const win2 = new WinBox({
     292        id:    "my-winbox2",
     293        title: 'Winbox + Interact Example: Drag, Scale and Rotate',
     294        x: 1000,
     295        y: 80,
     296        width: '900px',
     297        height: '600px',
     298        border: "0.3em",
     299        //background: "#29e",
     300        //html: "<p>Some Sample Text</p>"
     301        html: html_result
     302        });
     303       
     304        // user-select: none;
     305        // touch-action: none;
     306       
     307        let $win2 = $('#my-winbox2');
     308        let $scale_element_div = $('<div>')
     309        .attr("class","scale-element")
     310            .css("position","relative")
     311            .css("width","100%")
     312            .css("height","100%")
     313        .css("background-color", "#29e");
     314       
     315        $scale_element_div.append($win2.children()).clone();
     316       
     317        $win2.empty().append($scale_element_div);
     318       
     319        $('#my-winbox2 .wb-body').addClass("winbox-info-window");
     320   
     321       
     322        //
     323        //  interact('#my-winbox2')
     324        //  .draggable(draggable_options)
     325        //  .resizable(resizable_options);
     326        //
     327       
     328        let this_elem = document.getElementById('my-winbox2');
     329       
     330        let this_angle_scale = {
     331        angle: 0,
     332        scale: 1
     333        }
     334       
     335       
     336        let gdraggable_options = getCoreDraggableOptions();
     337        let gesturable_options = getCoreGesturableOptions(this_elem,this_angle_scale);
     338       
     339        interact('#my-winbox2')
     340        .gesturable(gesturable_options)
     341        .draggable(gdraggable_options);
     342       
     343    });
     344
     345
    322346    /*
    323347    interact('#my-winbox')
  • gs3-extensions/tabletop-dl/trunk/tabletop.css

    r37555 r37559  
    2525}
    2626
     27div.collectionLinkText {
     28    min-width: 365px;
     29}
     30
     31span.collectionAndGroupLinks {
     32    display: inline-block;
     33}
    2734
    2835
     
    93100    min-height: 6.5em;
    94101    margin: 0.5em;
    95    
    96     background-color: var(--gs-bg-primary-col);
    97     color: var(--gs-fg-primary-col);
     102
     103    /*
     104    background-color: var(--gs-bg-primary-col);
     105    color: var(--gs-fg-primary-col);
     106   */
     107   
     108    background-color: #fff;
     109    color: #000;
     110   
     111    border: 0.25rem var(--gs-bg-primary-col) solid;
    98112   
    99113    font-size: 1.2rem;
     
    111125}
    112126
     127
     128.winbox-info-window {
     129    min-height: 6.5em;
     130    margin: 0.5em;
     131
     132    /*
     133    background-color: var(--gs-bg-primary-col);
     134    color: var(--gs-fg-primary-col);
     135   */
     136   
     137    background-color: #fff;
     138    color: #000;
     139    /*
     140    border: 0.25rem var(--gs-bg-primary-col) solid;
     141   */
     142   
     143    font-size: 1.2rem;
     144
     145    /* border-radius: 0.6em; */
     146    padding: 1em;
     147
     148    touch-action: none;
     149    user-select:  none;
     150    transform: translate(0px, 0px);
     151
     152    /* This makes things *much* easier */
     153    box-sizing: border-box;
     154
     155}
     156
     157
     158.wb-header {
     159    background-color: var(--gs-bg-primary-col);
     160}
     161
     162.winbox {
     163    background-color: transparent;
     164}
     165
     166.wb-n {
     167    cursor: revert;
     168}
     169
     170
     171
     172/* Visual artefact turns up from box-shadow when roting */
     173/* This is due to the parent div dtaying in the same fixed place, but the
     174   scaled and rotated inner elements breaking out of that shap */
     175
     176/* Perhaps we only want none, when its being rotated? */
     177
     178.winbox {
     179    box-shadow: none;
     180}
     181
     182/* Report to help promote anti-aliasing affects on transform elements
     183
     184e.g. https://slickmedia.io/blog/stop-blurring-jagged-edges-css-transform-transition
     185
     186outline: 1px solid transparent;
     187-webkit-backface-visibility: hidden;
     188transform: translateZ(0);
     189will-change: transform;
     190-webkit-perspective: 1000;
     191*/
     192
     193   
    113194/* currently nothing specific for resize-drag that info-window does already do */
    114195/*
  • gs3-extensions/tabletop-dl/trunk/tabletop.xsl

    r37557 r37559  
    1717    <gslib:siteName/>
    1818  </xsl:template>
     19
     20
     21  <!-- This and the following template rule is copied verbatim from document.xsl -->
    1922 
     23  <xsl:template name="javascriptForDocumentView">
     24    <script type="text/javascript" src="interfaces/{$interface_name}/js/utility_scripts.js"><xsl:text> </xsl:text></script>
     25    <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script>
     26    <gsf:metadata name="Thumb" hidden="true"/>
     27    <script type="text/javascript">
     28      <xsl:text disable-output-escaping="yes">
     29    function goToAnchor(sectionID,anchor)
     30    {
     31        var docIdentifier = '</xsl:text><xsl:value-of select="//documentNode[@nodeType = 'root']/@nodeID"/><xsl:text disable-output-escaping="yes">';
     32        focusAnchor(docIdentifier + "."+ sectionID,0,1,anchor);
     33    }
     34      </xsl:text>
     35    </script>
     36    <xsl:call-template name="customJavascriptForDocumentView"/>
     37  </xsl:template>
     38
     39  <!-- Use this to add in extra javascript/files for an interface, site, collection -->
     40  <xsl:template name="customJavascriptForDocumentView">
     41  </xsl:template>
     42
    2043  <!-- the main layout is defined here -->
    2144  <xsl:template name="mainTemplate">
     
    2649        <!-- ***** in header.xsl ***** -->
    2750        <xsl:call-template name="create-html-header" />
     51    <xsl:call-template name="javascriptForDocumentView"/>
    2852
    2953   
Note: See TracChangeset for help on using the changeset viewer.