Commit graph

158 commits

Author SHA1 Message Date
Jürg Lehni
3f76bd99ef Implement an efficient mechanism to prioritize key in Item#set()
Closes #1096
2016-07-25 23:17:45 +02:00
Jürg Lehni
4f65996d34 Fix #1032: Correctly handle lastPoint in first mousemove.
Improve first attempt of a fix in e054b760ed
2016-04-13 15:52:59 -07:00
Jürg Lehni
e054b760ed Fix cases where toolPoint was null. 2016-03-27 21:41:22 -07:00
Jürg Lehni
b71e3a44d9 Fix #981: Make sure event.delta is always calculated correctly.
The first mousemove / mousedrag events wrongly received the delta from the last mouseup event.
2016-02-19 13:49:06 +01:00
Jürg Lehni
0a6efe10f5 Give Tool a paperscript example.
Closes #967
2016-02-13 23:31:54 +01:00
Jürg Lehni
849688833e Implement key events on View.
Closes #896
2016-01-27 11:36:39 +01:00
Jürg Lehni
cf924512c0 Further streamline and improve tool mouse-event handling. 2016-01-14 14:16:20 +01:00
Jürg Lehni
b8a1fbcd67 Implement new convention when to call event.preventDefault() after mouse-events:
- If any of the handlers were called, except for mousemove events which need to call `event.preventDefault()` explicitly, or `return false;`.
- If this is a mousedown event, and the view or tools respond to mouseup.
2016-01-14 11:19:54 +01:00
Jürg Lehni
1a6bf972d5 A lot of fine-tuning and fixing to better handle touch scrolling.
Relates to #686
2016-01-14 10:59:14 +01:00
Jürg Lehni
d5f2ff479d Further overhaul and streamline handling of view and tool mouse-events. 2016-01-14 02:08:33 +01:00
Jürg Lehni
00a7588a3a Allow any mouse handler to return true in order to enforce browser default.
Relates to #686
2016-01-13 19:04:03 +01:00
Jürg Lehni
8b0340e6df Have View#_handleEvent() also return true if event is handled.
And use it to call preventDefault() if either tool or view handle events.
2016-01-13 17:53:39 +01:00
Jürg Lehni
6d768f559a A whole lot of code clean-up in tool-event handling. 2016-01-13 17:27:45 +01:00
Jürg Lehni
35aabcc2b2 Move Tool#_updateEvent() to #_handleEvent() as private function. 2016-01-13 17:15:39 +01:00
Jürg Lehni
be0f6e373f Move Tool#_fireEvent() to #_handleEvent() as private function. 2016-01-13 16:48:34 +01:00
Jürg Lehni
799beabf69 Fix a regression in tool event handling.
If a tool has no mousedrag event, fall back on mousemove again.
2016-01-13 16:37:49 +01:00
Jürg Lehni
d7a88d0ef3 Fix endless loop in mousemove evnts caused by changes from #595. 2016-01-13 16:24:22 +01:00
Jürg Lehni
c23d87f5cf Merge remote-tracking branch 'megawac/event-emitting' into megawac-event-emitting 2016-01-13 16:08:33 +01:00
Jürg Lehni
db2beba831 Large refactoring of mouse-handling code on View and CanvasView.
Added support for:
- Better event bubbling
- mouseenter / mouseleave events on view
- Better handling of mousedrag / mousemove events on item and view
- Support for #removeOn() call in item / view handlers

Closes #845
2016-01-13 02:11:29 +01:00
Jürg Lehni
f2ae7840cf A lot of work on documentation.
- @values lists
- Improve event documentation
- Compound path
- etc.
2016-01-08 20:45:54 +01:00
Jürg Lehni
a7a07fb6d5 Update JSDoc and do some documentation spring-cleaning.
- Convert from {@code ...} to shorter `...`
- Reformat some documentation comment blocks
- Update copyright notices
2015-12-30 21:55:19 +01:00
Jürg Lehni
8eb0dcc87d Fix various JS linting problems. 2015-10-27 23:35:30 +01:00
Jürg Lehni
142ee6fd8a Shorten code a bit. 2015-08-21 17:42:33 +02:00
sapics
e15b23f8af code minifier 2015-06-23 13:09:48 +09:00
Graeme
5060a18263 Reuse the Tool mousedrag handlign logic for mousemove 2014-12-13 14:52:14 -05:00
Jürg Lehni
19a9976939 Return emitter in #on(), #off(), #once(), so calls can be chained. 2014-11-18 14:56:55 -08:00
Jürg Lehni
3b2a82047e Clean up event related comments, to reflect recent renaming. 2014-10-08 18:33:17 +02:00
Jürg Lehni
c7c49d4091 Time to go with the flow and use the on()/off()/emit() pattern for events. 2014-10-08 14:57:56 +02:00
Jürg Lehni
48cb05a181 Replace tabs with 4 white-spaces. 2014-08-16 19:24:54 +02:00
Jürg Lehni
f002c633a7 Remove trailing white spaces and ensure newlines at the end. 2014-04-06 13:48:03 +02:00
Jürg Lehni
59da291d54 Remove tabs in examples in favor of 4 spaces.
To remove all these annoying JSHint complaints.
2014-04-02 21:03:35 +02:00
Jürg Lehni
833d71f7ea Remove Item#type and replace it with Item#className, the non-hyphenated version of #type. 2014-03-18 11:42:38 +01:00
Jürg Lehni
e22fa3a664 Update copyright notice. 2014-01-04 01:47:16 +01:00
Jürg Lehni
976b24b34c Execute PaperScript using new Function() rather than eval() and with() {}
This results in some impressive speeding improvements, as modern JS engines are finally able to optimize the resulting code.
2013-12-29 15:32:23 +01:00
Jürg Lehni
2cfa329fa6 Completely rework event handling on view and tools.
Fixes multiple issues on iOS:
- mousedown events were sometimes fired twice.,
- the presence of mousedown handlers broke scrolling.
Closes #266.
2013-12-06 21:49:44 +01:00
Jürg Lehni
dc732da8d8 Clean up documentation for event handler functions on View and Tool. 2013-10-30 15:38:08 +01:00
Jürg Lehni
c945bf7908 Docs: Various smaller clean ups. 2013-10-16 14:20:13 +02:00
Jürg Lehni
19c7788617 Fix documentation irregularities. 2013-08-23 19:45:28 -07:00
Jürg Lehni
6b19f25f4b Fix typos in comments. 2013-08-08 15:21:35 -07:00
Jürg Lehni
85d7237c0f Avoid endless recursion in ToolEvent#middlePoint.
Closes #257.
2013-07-17 16:01:36 -07:00
Jürg Lehni
a4535edbb9 Bring back _class names, since code minification breaks reliance on constructor.name.
Closes #248.
2013-06-23 20:18:32 -07:00
Jürg Lehni
8c596927fb Store _removeSets per project, not globally. 2013-06-12 13:50:05 -07:00
Jürg Lehni
f59882b757 Handle Tool._removeSets also when there is no corresponding event handler installed.
Closes #204.
2013-06-12 13:46:14 -07:00
Jürg Lehni
10d5de3ed6 Implement a better way to name and export class constructors.
This change also simplified the way classes are exported to PaperScope objects.
2013-05-27 12:48:58 -07:00
Jürg Lehni
c533dda7b5 Finally found a better and faster alternative for this.base() calls, by setting base on the function object instead.
base can be accessed on named functions very easily, leading to another measurable speed increase. Finally all performance reasons against straps.js are eliminated!
2013-05-27 10:04:05 -07:00
Jürg Lehni
369b329b23 Change straps.js to directly use initialize() as constructor function rather than redirecting calls to it.
Should yield some interesting performance improvements.
2013-05-27 09:11:50 -07:00
Jürg Lehni
b59a98f7ce Add jQuery style aliases to Callback and use #on() in the examples rather than #attach(). 2013-05-06 20:56:58 -07:00
Jürg Lehni
98f7c020bd Use Item#type instead of instanceof checks for better performance. 2013-04-19 19:27:02 -07:00
Jürg Lehni
80600d2a2b Fix issue with removeOnMove() calls sometimes removing items too early.
Closes #181.
2013-03-05 15:22:44 -08:00
Jonathan Puckey
d4c0386e5b Tool example documentation. 2013-03-03 18:56:11 +01:00