libreoffice-online/loleaflet
2015-05-13 11:17:33 +03:00
..
build Parts control for switching between parts 2015-05-11 17:05:03 +03:00
debug Removed the Draw plugin interface 2015-05-08 11:44:37 +03:00
dist Search bar implemented as a leaflet Control 2015-05-06 12:39:03 +03:00
node_modules Added essential node modules to avoid npm install 2015-04-10 10:29:58 +03:00
plugins/draw-0.2.4 RemoveAll method for removing all selections 2015-04-07 20:21:32 +03:00
spec
src Fixed tiwps->latlng and backwards conversion 2015-05-13 11:17:33 +03:00
.eslintrc
.gitignore Ignore resulting js files in dist 2015-04-06 17:09:27 +03:00
.npmignore
.travis.yml
CHANGELOG.md
FAQ.md
Jakefile.js
LICENSE
package.json
PLUGIN-GUIDE.md
README Readme update that describes how to open a doc 2015-05-06 10:08:56 +03:00

Leaflet platform for LibreOffice On-Line
========================================

This is the client part of LibreOffice On-Line.  For the server part, see the
../loolwsd/README, and install it first.

Build dependencies
------------------

First you need to install 'jake'.  As root, do:

    npm install -g jake
    npm install

Alternatively, you can use the provided zip (as a normal user):

    unzip node_modules/modules.zip -d node_modules

Building
--------

As a normal user:

    jake build
    cd plugins/draw-0.2.4
    jake build

Running
-------

To see an example:

* run loolwsd, like:

    ./loolwsd --systemplate=${SYSTEMPLATE} --lotemplate=${MASTER}/instdir --childroot=${ROOTFORJAILS}

* open debug/document/document_simple_example.html in the browser, like:

    firefox debug/document/document_simple_example.html

* modify the URL to allow loleaflet to connect to a server and open a document

    http://web-page/document_simple_example.html?file_path=/PATH/TO/DOC&host=ws://localhost:9980

and you should see the document in the browser.  In case anything goes wrong,
check the loolwsd console for the debugging output.

Contributing
------------

Code conventions:

    * 'jake lint' should be run before commiting
    * files should have unix line terminators (LF)
    * tools to convert files: dos2unix or fromdos

Implementation details
----------------------

Loading a document:
    The map should have the following options:
        - center at [0, 0] this will try to place the [0, 0] point in the middle of the
          map, but it will be moved in the top left corner when the maxBounds are set
        - zoom = defautl zoom value, zooming in and out will refer to this value
        - server address

    The layer (actual document) should have the following options:
        - doc = path to the document that will be loaded
        - useSocket = tells the map the tiles will be received from a websocket
          connection. If this parameter is false, an image will be loaded in each tile

How zooming works:
    The zoom level goes from 1 to 20 (those limits can be changed) and the initial
    level is 10, which represents the 100% zoom level. The zoom factor is 1.2

Controls are added above the map in a div called "controls" is intended to be used as a toolbar.
There is no leaflet method of adding them in a separate div, so for now this is done in the html
document after the map initialization.

To enable scrollbars the map is placed above a div that contains a bigger div of
the document's size (a mock document). So the div under the map gets scrollbars which
are independent of the map's div, thus enabling us to link them to the map as needed.
When the user scrolls, the map is panned by the same amount as it would've been scrolled.
Also, some custom jquery scrollbars are used, to trigger the same scroll events across
browsers.