Commit Graph

16 Commits

Author SHA1 Message Date
FlashSystems 3918e59cc1
Fixed PR to fix popup position if popup is triggered from within an offsetParent element (#7013)
* 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.
2022-12-01 21:16:44 +00:00
jeremy@jermolene.com b9d27e9fd5 Revert "Fix popup position if popup is triggered from within an offsetParent element (#6887)"
This reverts commit 5b85786f73.
2022-10-22 13:22:15 +01:00
FlashSystems 5b85786f73
Fix popup position if popup is triggered from within an offsetParent element (#6887)
* 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`.
2022-10-22 13:13:39 +01:00
Simon Huber b4deb7cc45
Add tv-widgetnode-width and tv-widgetnode-height (#6681)
* Add tv-widgetnode-width and tv-widgetnode-height to collectDOMVariables

* Add docs

* update docs

* Update modified field
2022-05-09 10:42:23 +01:00
Jeremy Ruston 1d8c538e45
Eventcatcher widget: add "matchSelector" attribute (#6523)
* Initial Commit

* Allow matchSelector to be used even if selector attribute isn't used
2022-03-14 09:56:23 +00:00
twMat def9b553a8
typo in EventCatcherWidget.tid (#6399) 2022-01-15 12:57:51 +00:00
btheado 7a50603d9d
Added MessageHandlerWidgets and TriggeringWidgets tags (#6161) 2021-11-01 12:56:52 +00:00
jeremy@jermolene.com e9613d7f12 eventcatcher widget: Add viewport-relative coordinates
This is useful because we get viewport relative coordinates from the link and action-navigate widgets
2021-08-05 08:35:44 +01:00
jeremy@jermolene.com dbfd45814d Search and replace "v5.1.24" to "v5.2.0"
As discussed in #5708
2021-07-14 09:21:37 +01:00
Saq Imtiaz 30925ee7bf
Update syntax for Eventcatcher (#5868)
* Update syntax for Eventcatcher to be consistent with MessageCatcher while being backwards compatible

* Update docs

* Update docs
2021-07-11 20:21:35 +01:00
Saq Imtiaz 270ead4701
Eventcatcher: Fixed FF and IE bugs, added stopPropagation attribute (#5711) 2021-05-21 09:43:20 +01:00
jeremy@jermolene.com 40d21f607a Docs: Minor formatting tweaks
I was cloning this docs tiddler to experiment with docs for a new widget and noticed some punctuation inconsistencies
2021-02-07 12:48:06 +00:00
CodaCoder d5175e4fdc
Update EventCatcherWidget.tid (#5335)
* Update EventCatcherWidget.tid

Changed "JavaScript events" to "DOM-initiated Javascript events". 
Removed the quotes from `"event"`. 
Tightened up some of the language.

* Update EventCatcherWidget.tid

Edited/reworded as per discussion(s).
2021-01-04 08:40:35 +00:00
Saq Imtiaz 1f5e1205ec
Extend Eventcatcher to handle multiple events (#5185)
* support multiple events

* Add variables for event type and detail. Rename types attribute to events

* Correct typo in refresh handling
2020-12-02 21:15:35 +00:00
saqimtiaz 6c98bb706a
Docs for switching layouts (#5109) 2020-11-24 21:38:18 +00:00
saqimtiaz cb62c8c96d
Docs for eventcatcher (#5097) 2020-11-23 17:07:41 +00:00