* Fix popup location for tables
This commit introduces the `popupAbsCoords` option to the $button widget
and implements an absolut coordinate format.
Coordinates for popups are stored in the format `(x,y,w,h)`. These
coordinates are relative to the offset parent of the element that
defines the popup.
This commits adds a second format `@(x,y,w,h)`. Coordinates specified in
this format a relative to the pages root element.
The `popupAbsCoords` option of the $button widget enables the use of
this coordinates.
* Unify the declaration of the RegEx for parsing the popup-position
The regular expression was declared in three locations with the same
content. This commit supplies a new function `parseCoordinates` in
`popup.js`. This function returns the parsed coordinates and understands
the classic/absolute coordinates.
This function is used in `reveal.js` and `action-popup.js` to parse the
coordinates.
* Add documentation for coordinate systems
* Consolidate creating coordinate strings
The Popup object now contains a `buildCoordinates` method that can be
used to build coordinate strings. It takes an "enum" for the coordinate-
system to use. This makes everything easily extensible and prevents the
use of magic values.
* Add tests for `parseCoordinates` and `buildCoordinates`
* Add `tv-popup-abs-coords` to `collectDOMVariables`
This will make the absolute coordinates available for the
`DraggableWidget` and the `EventCatcherWidget`.
* Add documentation for the `tv-popup-abs-coords`
... to the `DraggableWidget` and the `EventCatcherWidget`.
* Fix crash when generating a static version of the TW
The Popup class is not initialized in `startup.js` if `$tw.browser` is
not true. After having consolidated the facilities for parsing
coordinate strings into `popup.js` this breaks because the static build
needs to parse coordinate stings even if no Popup module is initialized.
This commit solves this problem by making `readPopupState`,
`parseCoordinates` and `buildCoordinates` static methods of `popup.js`.
It also adds a comment to these functions to show that these can be called
safely even if the Popup-Class is not initialized.
* Fix popup location for tables
This commit introduces the `popupAbsCoords` option to the $button widget
and implements an absolut coordinate format.
Coordinates for popups are stored in the format `(x,y,w,h)`. These
coordinates are relative to the offset parent of the element that
defines the popup.
This commits adds a second format `@(x,y,w,h)`. Coordinates specified in
this format a relative to the pages root element.
The `popupAbsCoords` option of the $button widget enables the use of
this coordinates.
* Unify the declaration of the RegEx for parsing the popup-position
The regular expression was declared in three locations with the same
content. This commit supplies a new function `parseCoordinates` in
`popup.js`. This function returns the parsed coordinates and understands
the classic/absolute coordinates.
This function is used in `reveal.js` and `action-popup.js` to parse the
coordinates.
* Add documentation for coordinate systems
* Consolidate creating coordinate strings
The Popup object now contains a `buildCoordinates` method that can be
used to build coordinate strings. It takes an "enum" for the coordinate-
system to use. This makes everything easily extensible and prevents the
use of magic values.
* Add tests for `parseCoordinates` and `buildCoordinates`
* Add `tv-popup-abs-coords` to `collectDOMVariables`
This will make the absolute coordinates available for the
`DraggableWidget` and the `EventCatcherWidget`.
* Add documentation for the `tv-popup-abs-coords`
... to the `DraggableWidget` and the `EventCatcherWidget`.
* Jeremy's original version of the event widget
* Renamed to eventcatcher, added modifier key support and mouse button support as variables
* Reveal widget: update popup position when state tiddler updates
It turns out that the `localeCompare` function used by `compareStateText()` is very, very slow. Replacing it with a straightforward equality test makes one of my test rigs be 10x faster...
Note that this PR reverts the behaviour of match/nomatch to that before #3157. That change was not backwards compatible in that the switch to localeCompare meant that é === e, now it doesn't again.
@BurningTreeC I think this might have been a typo in your recent refactorings; if you look back at an old version such as c0c1b557eb/core/modules/widgets/reveal.js then there is no sign of this fallback.
Fixes#3874
* make triggerPopup optionally set state directly
* update button widget for new state attributes
* update reveal widget for new state attributes
* fix errors in button widget
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
Previously, when displayed content is hidden by the reveal widget there
was an optimisation such that the content was retained in the DOM but
hidden using CSS, so that it could be shown again quickly.
It turns out that a sideeffect of that optimisation is that clicking
through all the sidebar tabs leaves them all active, so that they all
need to be refreshed whenever a character is typed in an editor.
This commit suppresses the optimisation, so that hidden content is
removed from the DOM and the render tree.
Getting rid of the old widget mechanism files finally gives us a payoff
for all the refactoring. Still a bit of tidying up to do, and we need
to re-introduce the animation mechanisms.
Get rid of the separate renderContext stack and instead have a parent
pointer on renderer nodes. This lets us walk back up the render tree to
resolve context references
This arrangement takes better advantage of the similarities between the
now deleted widget renderer and the element renderer. It also obviates
the need for wrapper elements around every widget.