Changeset 37555 for gs3-extensions


Ignore:
Timestamp:
2023-03-23T13:28:55+13:00 (13 months ago)
Author:
davidb
Message:

Some gradual improvements to the features supported, ready to be incorporated as an XSL generated page in Greenstone

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

Legend:

Unmodified
Added
Removed
  • gs3-extensions/tabletop-dl/trunk/RSYNC-INSTALL-TABLETOP-DL.sh

    r37536 r37555  
    11#!/bin/bash
    22
    3 if [ ! -d ../../web/tabletop-dl ] ; then
    4     echo "Making directory ../../web/tabletop-dl"
    5     mkdir ../../web/tabletop-dl
     3dst_dir=../../web/ext/tabletop-dl
     4
     5if [ ! -d $dst_dir ] ; then
     6    echo "Making directory $dst_dir"
     7    mkdir $dst_dir
    68fi
    79
    8 cd .. && rsync -pav \
    9            tabletop-dl/tableletop*.*  \
    10            tabletop-dl/backgrounds  \
    11            ../web/tabletop-dl/.
     10rsync -pav \
     11      tabletop*.*  \
     12      backgrounds  \
     13      interactjs-dist \
     14      winbox-with-interactjs-dist \
     15      $dst_dir/.
  • gs3-extensions/tabletop-dl/trunk/tabletop-interact.js

    r37538 r37555  
    4040}
    4141
     42// http://localhost:8383/greenstone3/library
     43
    4244function getCoreResizableOptions()
    4345{
     
    4749       
    4850    listeners: {
     51
     52        moveNEWER: function (event) {
     53        let { x, y } = event.target.dataset
     54       
     55        x = (parseFloat(x) || 0) + event.deltaRect.left
     56        y = (parseFloat(y) || 0) + event.deltaRect.top
     57       
     58        Object.assign(event.target.style, {
     59            width: `${event.rect.width}px`,
     60            height: `${event.rect.height}px`,
     61            transform: `translate(${x}px, ${y}px)`
     62        })
     63       
     64        Object.assign(event.target.dataset, { x, y })
     65        },
     66       
    4967        move (event) {
    5068        var target = event.target
    5169        var x = (parseFloat(target.getAttribute('data-x')) || 0)
    5270        var y = (parseFloat(target.getAttribute('data-y')) || 0)
     71        //var x = (parseFloat(target.getAttribute('data-x')) || target.style.clientLeft)
     72        //var y = (parseFloat(target.getAttribute('data-y')) || target.style.clientTop)
    5373       
    5474        // update the element's style
     
    6282        target.style.transform = 'translate(' + x + 'px,' + y + 'px)'
    6383       
     84        //var target_new_x_org = target.clientLeft + event.deltaRect.left;
     85        //var target_new_y_org = target.clientTop  + event.deltaRect.top;
     86
     87        //target.style.left = target_new_x_org + 'px';
     88        //target.style.top  = target_new_y_org + 'px';
     89
     90        //target.style.left = x + 'px';
     91        //target.style.top  = y + 'px';
     92
    6493        target.setAttribute('data-x', x)
    6594        target.setAttribute('data-y', y)
     
    82111    ],
    83112       
    84    
    85     inertia: {
     113    inertia: false
     114   
     115    /*inertia: {
    86116            resistance: 6,
    87117            //minSpeed: 20,
     
    89119            smoothEndDuration: 500,
    90120            allowResume: true
    91     }       
     121    }*/     
    92122    };
    93123
     
    109139        let currentScale = event.scale * angleScale.scale;
    110140       
    111         let scale_elem = $(elem).find('.scale-element')[0];
    112        
    113         scale_elem.style.transform =           
    114             'rotate(' + currentAngle + 'deg)' + 'scale(' + currentScale + ')';
     141        //let scale_elem = $(elem).find('.scale-element')[0];
     142       
     143        //scale_elem.style.transform =         
     144        //    'rotate(' + currentAngle + 'deg)' + 'scale(' + currentScale + ')';
     145
     146        let $scale_elem = $(elem).find('.scale-element');
     147       
     148        $scale_elem.css(
     149            'transform',
     150            'rotate(' + currentAngle + 'deg)' + 'scale(' + currentScale + ')'
     151        );
     152
    115153       
    116154        dragMoveListener(event);
     
    204242
    205243$(document).ready(function() {
    206    
    207     const win1 = new WinBox({
    208     id:    "my-winbox1",
    209     title: 'Winbox + Interact Example 1',
    210     x: 200,
    211     y: 200,
    212     width: '400px',
    213     height: '400px',
    214     border: "0.3em",
    215     background: "#29e",
    216     html: "<p style=\"padding: 8px; color: #000;\">This window can be dragged around and resized</p>"
    217     });
    218    
    219     let draggable_options = getCoreDraggableOptions();
    220     let resizable_options = getCoreResizableOptions();
    221    
    222     draggable_options.autoScroll = true;
    223    
    224     interact('#my-winbox1')
    225     .draggable(draggable_options)
    226     .resizable(resizable_options);
     244
     245    $.ajax({
     246    url: "http://localhost:8383/greenstone3/library?excerptid=collectionAndGroupLinks"
     247    })
     248    .done(function(data) {
     249        const winbox1 = new WinBox({
     250        id:    "my-winbox1",
     251        title: 'Winbox + Interact Example 1',
     252        x: 200,
     253        y: 200,
     254        width: '900px',
     255        height: '400px',
     256        border: "0.3em",
     257        background: "#29e",
     258        html: data
     259
     260        });
     261
     262        $('#my-winbox1 .wb-header').css("user-select", "none");
     263        $('#my-winbox1 .wb-header').css("touch-action","none");
     264       
     265        let draggable_options = getCoreDraggableOptions();
     266        let resizable_options = getCoreResizableOptions();
     267       
     268        draggable_options.autoScroll = true;
     269   
     270        interact('#my-winbox1')
     271        .draggable(draggable_options)
     272        .resizable(resizable_options);
     273    });
    227274
    228275
     
    237284    border: "0.3em",
    238285    background: "#29e",
    239     html: "<p class=\"scale-element\" style=\"padding: 8px; color: #000;\">This window can be dragged around, rotated and zoomed in and out</p>"
     286    html: "<p classXXX=\"scale-element\" style=\"padding: 8px; color: #000;\">This window can be dragged around, rotated and zoomed in and out</p>"
    240287    });
    241    
     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   
    242300    /*
    243301    interact('#my-winbox2')
  • gs3-extensions/tabletop-dl/trunk/tabletop.css

    r37529 r37555  
    2222    font-family: Helvetica, Arial, "Open Sans", OpenSans, sans-serif;
    2323    color: var(--gs-fg-primary-col);
     24    background-color: transparent;
    2425}
    2526
Note: See TracChangeset for help on using the changeset viewer.