Commit graph

1957 commits

Author SHA1 Message Date
Jan Holesovsky
128bfcec10 Never ignore scroll.
After 'make clear-cache', sometimes causes losing scroll events (the user
moves the scrollbar, but the document does not move).
2015-05-30 04:12:03 +02:00
Mihai Varga
865f23d4e7 Use SearchItem.SearchStartPoint 2015-05-29 14:18:39 +03:00
Tor Lillqvist
7721409594 Post-release bump to 1.0.9 2015-05-29 09:41:25 +03:00
Tor Lillqvist
96e0b433a7 Bump version to 1.0.8 for tarball 2015-05-29 09:40:54 +03:00
Mihai Varga
2fa440c18f Status indicator control 2015-05-28 18:43:29 +03:00
Mihai Varga
1d34f8f0a8 Set pointer cursor in viewmode 2015-05-28 17:43:53 +03:00
Mihai Varga
d8dd709377 setpart command handler 2015-05-28 17:22:45 +03:00
Henry Castro
e974f7c98c Fixed EMPTY invalidattiles 2015-05-28 09:36:52 -04:00
Tor Lillqvist
6968bd1c3c This should obviously be noarch 2015-05-28 11:19:20 +03:00
Mihai Varga
f999c337b9 Better differentiate commands, status vs statusindicator 2015-05-28 11:02:12 +03:00
Miklos Vajna
36c94140ef loleaflet: document ~/.npmrc prefix setting 2015-05-27 16:09:04 +02:00
Tor Lillqvist
beb321d142 Revert attempts at sanity 2015-05-27 16:33:49 +03:00
Tor Lillqvist
6b91320f69 Intermediate non-working attempt at sanity 2015-05-27 16:29:57 +03:00
Tor Lillqvist
85e98d5231 Don't put superfluous stuff in the tarball, and bump version to 1.0.2 2015-05-27 14:58:41 +03:00
Henry Castro
6742cd8046 Capture invalidatetiles when keys are pressed
There is a problem with fade and opacity. they
are set to 0.
2015-05-26 23:51:52 -04:00
Henry Castro
9287074b75 Added cursor visible and invalidate cursor 2015-05-26 20:52:35 -04:00
Henry Castro
8d094fbf3f Added keypress function to send keys 2015-05-26 20:37:11 -04:00
Mihai Varga
bd642c3d37 Make the view/edit text in the control unselectable 2015-05-26 20:56:27 +03:00
Mihai Varga
22232e070f Dragging will be handled in the js code 2015-05-26 20:56:27 +03:00
Mihai Varga
77b8e0d126 Edit/View switching handler 2015-05-26 20:56:27 +03:00
Mihai Varga
7b79f0edd5 Control for switching between viewing and editing mode 2015-05-26 20:56:27 +03:00
Jan Holesovsky
bc02be9812 Don't cycle the parts, stop at 0 / max. 2015-05-25 18:43:18 +02:00
Mihai Varga
29d4296d12 Disable prev/next part buttons for the first/last part 2015-05-25 17:52:36 +03:00
Mihai Varga
57cb4fe243 Prune tiles after switching parts 2015-05-25 17:36:18 +03:00
Mihai Varga
bcdf048d6d Merge adjacent selection rectangles into a single polygon
+ the document is scrolled to the average center of the rectangles
if that is out of the viewing area
2015-05-25 16:54:29 +03:00
Mihai Varga
139bae53c1 Fixed the incorrect tile rendering after zooming problem
Leaflet originally discarded tiles from different zoom levels
and I initially thought setting the opacity to 0 will be enough
and this way tiles will remain in cache.
But this does not work so tiles are now removed from the dom tree
and added in a cache to be later reused
2015-05-22 14:35:06 +03:00
Tor Lillqvist
95b25f2de7 Add a spec file for leaflet to package it
Ugly hack.
2015-05-20 20:46:12 +03:00
Mihai Varga
a59dd5d278 Forgot to remove debugging output 2015-05-20 18:51:15 +03:00
Mihai Varga
19e94da931 Handle 'searchnotfound' command 2015-05-20 16:54:40 +03:00
Mihai Varga
531cccc026 Mouse handlers
It works for: click, dblclick and dragging
2015-05-20 16:54:40 +03:00
Tor Lillqvist
12e0a880f6 Revert "We want 'make dist' to actually create a *source* tarball"
Nah. Trying to package this JS crack in RPM so that it is buildable from
source on openSUSE does not seem easy. Let's just package the deliverables for
now. Those who want to look at sources can use git.

This reverts commit 434550f352.
2015-05-20 16:00:47 +03:00
Tor Lillqvist
434550f352 We want 'make dist' to actually create a *source* tarball
Use 'git archive' of the loleaflet subdirectory.
2015-05-20 14:59:18 +03:00
Tor Lillqvist
873e7c5102 Add a Makefile to create a tarball
Not sure whether this makes sense, but for now...
2015-05-19 14:29:55 +03:00
Mihai Varga
c2f0b5b17d Pressing enter always searcheas forward 2015-05-18 18:03:26 +03:00
Mihai Varga
51bbdd91ed Prevent document from jumping when zooming 2015-05-18 17:40:55 +03:00
Mihai Varga
a4391c1017 Fix for stack size limit exceded 2015-05-18 16:10:24 +03:00
Mihai Varga
428f6dbe6f Match the background color with what LOkit provides 2015-05-18 15:34:21 +03:00
Mihai Varga
40552d424c Clear selections when the search string is modified 2015-05-18 10:37:20 +03:00
Mihai Varga
249d8fdaf6 Finished the parts control 2015-05-18 10:30:51 +03:00
Mihai Varga
e55d216708 No search result -> the search bar flashes red
This still needs work because the search bar will flash
if the user clicks on the map and doesn't select anything.
This will need a proper 'no-result-found' message from the server
2015-05-18 09:15:23 +03:00
Mihai Varga
b482dabe37 Alert when there is a connection error 2015-05-15 18:35:05 +03:00
Mihai Varga
cb33fd5035 Added selection border and set the selection color to: #43ACE8 2015-05-15 17:00:43 +03:00
Mihai Varga
94396cf87b Searh next/prev searches the latest enterd value 2015-05-15 16:19:59 +03:00
Mihai Varga
40172d3dd5 'Part' command is now parsed and interpreted 2015-05-15 15:14:02 +03:00
Mihai Varga
ed5491921a Update scrollbars on window resize 2015-05-15 14:37:14 +03:00
Mihai Varga
fe40e3d592 Less space between the toolbar and the document 2015-05-15 13:07:05 +03:00
Mihai Varga
a3cc8784fb Text mouse cursor (editing cursor) 2015-05-15 13:06:43 +03:00
Mihai Varga
ab86440cb2 Prevent img drawing on mozilla 2015-05-15 12:46:01 +03:00
Mihai Varga
c057a42063 Working text selection by mouse dragging 2015-05-15 12:12:11 +03:00
Mihai Varga
c2c379ac69 Removed unnecessary variables 2015-05-15 12:12:11 +03:00
Mihai Varga
906e9e28fc Search scrolls to result if it's out of the viewing area 2015-05-13 12:39:57 +03:00
Mihai Varga
5e4225c860 In fact, it is better not to prefix the url 2015-05-13 12:05:13 +03:00
Mihai Varga
04d2b531a1 Check if file:// is added in the url 2015-05-13 12:01:10 +03:00
Mihai Varga
0a7e20e851 Encode spaces in the URL 2015-05-13 11:54:12 +03:00
Mihai Varga
124de292d1 Updated the text selection handler
And also removed an unnecessary method
2015-05-13 11:17:34 +03:00
Mihai Varga
e4b1624d2b Updated the search bar to send the correct command to the server 2015-05-13 11:17:34 +03:00
Mihai Varga
bc23033537 Fixed tiwps->latlng and backwards conversion 2015-05-13 11:17:33 +03:00
Mihai Varga
d78642806a Removed URL tiles specific methods 2015-05-11 17:55:38 +03:00
Mihai Varga
47e301cc92 Parts command from the server is parsed but not yet interpreted 2015-05-11 17:05:03 +03:00
Mihai Varga
4c6d87231c Parts control for switching between parts 2015-05-11 17:05:03 +03:00
Mihai Varga
90b3b32bbc Renamed method to _parseServerCmd 2015-05-11 17:05:03 +03:00
Mihai Varga
13582c7f04 Fixed typo 2015-05-11 17:05:03 +03:00
Mihai Varga
febaaa1900 Mouse event handlers for selection 2015-05-08 15:24:47 +03:00
Mihai Varga
1858147801 Twips to latlng and reverse methods 2015-05-08 15:24:26 +03:00
Mihai Varga
affdbc6ff1 Added search command (from the server) handler 2015-05-08 13:58:13 +03:00
Mihai Varga
5dabc12660 Search bar buttons are updated based on the current search index 2015-05-08 13:56:28 +03:00
Mihai Varga
c622852514 Removed the Draw plugin interface
We don't actually need this plugin because the server
dictates how the selection will work.
Will remove the whole plugin when I'm sure this won't have other
applications
2015-05-08 11:44:37 +03:00
Mihai Varga
5bde4775f6 Added cancel search button + search bar sends propper events 2015-05-08 11:10:48 +03:00
Tor Lillqvist
d3acdbb225 String::startsWith is Firefox-only it seems 2015-05-06 18:41:09 +03:00
Mihai Varga
15a889db91 Search bar implemented as a leaflet Control
It is not ready yet, buttons' functionality and the search
functionality is to be added
2015-05-06 12:39:03 +03:00
Mihai Varga
57a2663cb9 Search bar bax with prev and next buttons 2015-05-06 10:41:26 +03:00
Mihai Varga
1b5f9b1f22 Readme update that describes how to open a doc 2015-05-06 10:08:56 +03:00
Mihai Varga
bc5bee6751 Smoother scroll without intertia 2015-05-06 09:44:32 +03:00
Mihai Varga
b9351c6fed Forgot to replace evt.data with textMsg 2015-05-06 09:37:44 +03:00
Mihai Varga
6c6f8c29de Document file path and host are encoded in the url
Usage:
http://web-page?file_path=/PATH/TO/DOC&host=ws://localhost:9980
2015-05-06 09:35:22 +03:00
Mihai Varga
22276e7975 Better msg reading method that allows adding new types of msgs 2015-05-04 18:36:47 +03:00
Mihai Varga
4b31303cc0 Let leaflet track window resize 2015-05-04 18:02:32 +03:00
Mihai Varga
55508c6680 Enabled doc. nagivation by keyboard and mousewheel
Scrolling now works from the arrowkeys, pgUp, pgDown
Home and End buttons and also from the mouseWheel
TODO update the compressed file
2015-05-04 16:29:23 +03:00
Mihai Varga
bc29447b86 Removed trailing whitespaces from scrollbar code 2015-05-04 16:26:02 +03:00
Mihai Varga
7d3458eb5e This fixes a bug that's triggered when zooming at document's end 2015-05-04 11:20:36 +03:00
Mihai Varga
a03e9f2e73 Updated readme to reflect the new changes 2015-05-04 11:20:36 +03:00
Mihai Varga
fa15ef1b20 Updated the example document 2015-05-04 11:20:36 +03:00
Mihai Varga
320e094a47 Scroll event handlers + document centering
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.
2015-05-04 11:20:36 +03:00
Mihai Varga
f0502879b4 New containers + restored some methods implementations to their original
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
2015-05-04 11:20:36 +03:00
Mihai Varga
c788ab8886 Event handlers for the new scrollbars 2015-05-04 11:20:36 +03:00
Mihai Varga
bee74de059 CSS updates for the new div elements 2015-05-04 11:20:36 +03:00
Mihai Varga
43c68037ec Custom scrollbars for document navigation
jQuery scrollbars, they should be easy to replace if we find something
better, maybe something written in vanilla javascript
Github project: https://github.com/malihu/malihu-custom-scrollbar-plugin
MIT license available at:
https://github.com/malihu/malihu-custom-scrollbar-plugin/blob/master/LICENSE.txt
2015-05-04 11:20:36 +03:00
Mihai Varga
dd8a9f8145 Leaflet small fixes 2015-05-04 11:20:36 +03:00
Tor Lillqvist
1b06290d2b Add a part parameter to the tile messages
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?)
2015-04-27 21:30:26 +03:00
Mihai Varga
9cd120f7ab Restore scrollbar offset 2015-04-27 16:03:50 +03:00
Mihai Varga
b6671341a7 The map handles keypress events but no panning keys 2015-04-27 10:18:13 +03:00
Mihai Varga
7fa1ae861d The map should not yet handle keyboard events 2015-04-27 09:57:06 +03:00
Mihai Varga
caf7c2e6c6 The map should not trace a resize event
The container div should handle the resize by updating the scrollbars
This fixes the map crash during window resize.
2015-04-24 17:21:38 +03:00
Mihai Varga
497a50c76d Tiles are added again in batch
This gives us smoother and faster tile loading
and a tile is requested just once
2015-04-22 20:49:20 +03:00
Mihai Varga
d0f77df767 Removed image link 2015-04-22 20:15:42 +03:00
Mihai Varga
caf1773e54 The map no longer moves when zooming == smoother zooming
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
2015-04-22 17:49:06 +03:00
Jan Holesovsky
0214f331e7 test document: Make it clear the white area is deliberate. 2015-04-22 08:41:09 +02:00
Jan Holesovsky
ff81959c7b Updated the loleaflet README. 2015-04-21 16:03:48 +02:00
Mihai Varga
37dfad0672 Removed pop that displays pixel location 2015-04-15 14:02:33 +03:00
Mihai Varga
3bf5939f8c We no longer need the timeout
Another commit must have fixed the thing that caused the crash
2015-04-15 10:16:47 +03:00
Mihai Varga
62c394f5bd This does not work well yet 2015-04-15 10:13:57 +03:00
Mihai Varga
57a0050421 Selection handler in leaflet 2015-04-13 20:46:09 +03:00
Mihai Varga
b666dc7d47 This better handles the scroll percentage after zooming 2015-04-13 10:39:12 +03:00
Mihai Varga
54d0af6fb8 How zoom works 2015-04-10 16:29:01 +03:00
Mihai Varga
144c9ab1df Fixed some js lint errors 2015-04-10 16:23:23 +03:00
Mihai Varga
2aa7f55ea8 Zooming now works properly
The initial zoom level is 10 and it goes to:
1, which is 10% and 20, which is 200%
2015-04-10 16:15:55 +03:00
Mihai Varga
9ecc37d433 Method for adding map controls to the toolbar div 2015-04-10 14:23:46 +03:00
Mihai Varga
565ac27cb6 Readme instruction on how to use archived modules 2015-04-10 10:33:19 +03:00
Mihai Varga
225bbbc24a Added essential node modules to avoid npm install 2015-04-10 10:29:58 +03:00
Mihai Varga
94f8076332 Map initial maxBounds are set in the constructor 2015-04-08 11:38:45 +03:00
Mihai Varga
4d8028613b Document is placed in the middle of the screen 2015-04-08 11:01:45 +03:00
Mihai Varga
e0da2747cc RemoveAll method for removing all selections 2015-04-07 20:21:32 +03:00
Mihai Varga
d8c221b9c2 Renamed tooltips to resemble selection and removed surface area 2015-04-07 20:20:27 +03:00
Mihai Varga
0120711974 Place toolbar items next to each other 2015-04-07 18:01:43 +03:00
Mihai Varga
a212001512 Workaround for drawing shapes bug.
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.
2015-04-06 17:20:43 +03:00
Mihai Varga
e2d5e35597 README update 2015-04-06 17:14:21 +03:00
Mihai Varga
4b7362ac08 Ignore resulting js files in dist 2015-04-06 17:09:27 +03:00
Mihai Varga
a7f9b427d6 This is generated by the build 2015-04-06 17:06:50 +03:00
Mihai Varga
98e9b6ecb0 Added draw control to the example html doc 2015-04-06 17:02:43 +03:00
Mihai Varga
20195a3f43 Fixed js lint errors 2015-04-06 16:30:09 +03:00
Mihai Varga
f76216071e Use node modules from leaflet 2015-04-06 16:20:46 +03:00
Mihai Varga
c88e7260a4 This file is generated by the build, no for it to be on git 2015-04-06 12:39:11 +03:00
Mihai Varga
ff700ae813 Added Leaflet.Draw-0.2.4
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
2015-04-06 12:23:19 +03:00
Mihai Varga
206a2538d6 Container's background color is the same as document's #F0F0F0 2015-04-06 10:09:16 +03:00
Mihai Varga
3fc926348d Zooming is animated again 2015-04-06 09:55:12 +03:00
Mihai Varga
4d66d025fa Center restore after zoom 2015-04-03 17:22:19 +03:00
Mihai Varga
f870f78e1d Prefetch 1 tile wide border around current visible area
If the user scrolls slowly he won't notice the loading tiles.
2015-04-03 14:04:01 +03:00
Mihai Varga
54cf584a35 Only load tiles from the visible area (outer container)
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.
2015-04-03 14:00:59 +03:00
Mihai Varga
67e183105f This places the controls above the map (in another div)
I have no experience with css but this works
TODO: needs proper fixing
2015-04-03 12:01:02 +03:00
Mihai Varga
61210a92a3 Initialize the outer div (container) in map's constructor
This will be later used to get the center of the viewspace
2015-04-02 19:36:22 +03:00
Mihai Varga
48c92dd555 Document is no longer dragable and scrollable
Mouse scrolling is now actualy scrolling instead of zooming
2015-04-01 13:10:17 +03:00
Mihai Varga
3da367096d Don't request invalid tiles 2015-04-01 11:24:31 +03:00
Mihai Varga
0811e2eb99 Use L.DomUtil instead of direct element access 2015-04-01 11:12:45 +03:00
Mihai Varga
d1fe237992 Update document info only if given status is different
Document info = height and width
2015-03-31 19:55:37 +03:00
Mihai Varga
283b35ab6e This fixes the loading problem
The document now loads and zooms smoothly
2015-03-31 19:51:42 +03:00
Mihai Varga
c22280f47c Removed unnecessary map._update() call 2015-03-30 19:22:17 +03:00
Mihai Varga
04403ff782 Update div dimension when zooming for the scrollbar 2015-03-30 19:21:21 +03:00
Mihai Varga
4944fcc57d Detached controls from the map and added scrollbars
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
2015-03-30 19:20:04 +03:00
Mihai Varga
5d6cbc4ed8 Switched the order in which docPixelLimits is created 2015-03-30 19:18:58 +03:00
Mihai Varga
c6ecfeaf8a Adapt document loading command to new protocol 2015-03-30 19:16:50 +03:00
Mihai Varga
b138c2431d Tiles are cached on the client side
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
2015-03-24 16:26:40 +02:00
Tor Lillqvist
32de8661bc Mention how to run npm without root 2015-03-24 13:15:43 +02:00
Mihai Varga
3b2c3a69df Mentioned about 'jake lint' in README 2015-03-23 19:37:42 +02:00
Mihai Varga
dc97c7eabd Fixed some lintjs coding style errors 2015-03-23 19:36:01 +02:00
Mihai Varga
624873cf47 Added instructions on how to use loleaflet + an example 2015-03-23 19:24:39 +02:00
Mihai Varga
31f5141c46 Added zoom functionality
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.
2015-03-23 19:05:25 +02:00
Mihai Varga
5db22c1962 Temporary dded zoom control back 2015-03-23 18:57:23 +02:00
Mihai Varga
3921903e8e MaxBounds are set automatically based on the size specified by loolwsd 2015-03-20 10:05:22 +02:00
Mihai Varga
fe757bfc12 Workaround for Leaflet issue #3320 2015-03-20 10:02:58 +02:00
Mihai Varga
aa5d7c9ccc Fixed tiles interleaving problem + allowed static layers to be added
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
2015-03-19 19:08:29 +02:00
Mihai Varga
0c5b654194 Tiles are now loaded from a loolwsd server
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
2015-03-16 17:46:20 +02:00
Mihai Varga
a8075b8250 Added websockets to the Map object
'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.
2015-03-16 17:38:19 +02:00
Mihai Varga
2213e76a32 Removed zoom control and attribution display 2015-03-16 17:33:07 +02:00
Mihai Varga
87dc6f5b8f Set LF line terminator 2015-03-09 15:58:37 +02:00
Mihai Varga
3d64e7764f Readme that explains how to build and states code convetions 2015-03-09 15:54:27 +02:00
Mihai Varga
699cab4ced Removed initial README and contributing guide 2015-03-09 15:54:01 +02:00
Mihai Varga
bb6fd2206a Unmodified Leaflet
Checkout date: 09/03/2015
HEAD: a92c8a3c21f8d580de2dfd1e937ea90db76787b6
2015-03-09 12:16:17 +02:00