The document is centered by setting map's maxBounds
There are 2 types of scroll events:
- one generated during scrolling which actually pan's the map
- one generated when scrolling stops, this is used to keep track of
scrolling events
When the document is zoomed, the scrollbars are placed at the right
offset as the document's dimension changes and this is done with
the scrollTo method after temporarily disabling the event listener.
Added scrollContainer - the div that will get scrollbars
mockDoc - a mock document div of size equal to the document's, which
will cause the appearance of scrollbars
The size of the map now equals the visible area, so I've restored
the methods to work on this new size
The JS code always passes in 0 for now. The server parses the parameter and
calls LibreOfficeKitDocument::setPart() before calling paintTile().
Probably also the status, key, mouse and selection messages will need a part
number. The intent is after all that the protocol is as stateless as
possible. (So maybe we should also pass the document URL in each message?)
The zoomed tiles now perfectly match the new ones that are about
to be received from the server.
The zooming factor is again exponentail (1.2) instead of linear.
TODO: when the window size modifies the gets paned out of the bounds
Without this shapes cannot be shrunken when they are being drawn.
If draw a shape and then move the mouse inside it (to reduce its size)
the wrong type of event is fired and the shape is not updated.
Draw is a plugin that adds support for drawing and editing vectors and
markers on Leaflet maps. This will be used to create selections on the
document.
Source code: https://github.com/Leaflet/Leaflet.draw
Licence: MIT
Previous to this, the whole documnet was loaded because of the way
scrollbars have been added.
Now the visible area is determined by the current scrollbar position
and the outer container's size.
The "controls" div holds map controls suchs as the Zoom button and
it's separated from the map in order to have the controls on the top
of the page all the time.
The "document-container" div is the actual display of the document, is
what the user sees and it should be no larger than the screen size.
The "map" div is the actual document and it has the document's size
and width, this being inside the smaller "document-container" will
cause the content to overflow, creating scrollbars
Updated the removeTile method to just mark the tile as
not current and the set _update method not to 'hide'
(set opacity to 0) tiles from the current zoom level
The document can be zoomed in an out. Each zoom level corresponds
to a 20% increase or decrease in tile dimmension (in twips).
Zooming doesn't work well yet. Tiles are removed and readded to
many times and it looks bad. Also the zooming center has to be fixed.
Tiles are now correctly displayed.
Layers that request tiles from a socket connection need to specify
the 'useSocket: true' option. This way layers that do not require an
internet connection can be added (like a grid, ruler, etc.).
I've also fixed some coding style problems suggested by lintjs
the '_addTile' method now also handles tiles comming from a websocket.
Tiles are no longer added in one batch as they are added when received.
Added twip to pixel and pixel to twip convertor methods.
1 twip = 15 px
'onopen' and 'onmessage' events are handled
in src/layer/tile/TileLayer.js
Tile data is received as an ArrayBuffer which contains a string message
followed by a new line and then by the actual PNG data. The PNG data
is encoded in base-64 in order to be displayed.