You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: recipe/0599-drag-and-drop/index.md
+43-15Lines changed: 43 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,36 +13,64 @@ topic:
13
13
14
14
As a person wanting to annotate a IIIF resource, you would like to open a manifest in a viewer not available in the web interface where you first find the resource.
15
15
16
+
Alternately, as a viewer developer, you would like to allow your viewer to accept manifests from dragged-over items.
17
+
16
18
## Implementation Notes
17
19
18
-
Implementing this recipe requires a resource provider and a viewer provider each to implement their part. The resource provider must have a draggable item that can have a `dataTransfer.setData` method attached to the item's `dragstart` event and the viewer provider must have an interface capable of handling the data in its `drop` event.
20
+
Implementing this recipe requires a resource provider and a viewer each to implement their part.
21
+
22
+
### For Resource Providers
23
+
24
+
The resource provider must have a draggable item — such as an image — that makes use of the DataTransfer object. It will have a [`dataTransfer.setData` method](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) attached to the item's `dragstart` event.
25
+
26
+
### For Viewer Developers
27
+
28
+
A supporting viewer must have an interface capable of handling the DataTransfer object's data carried by the draggable item in its `drop` event.
19
29
20
30
## Restrictions
21
31
22
32
Because implementation is two-part, you may only have control over one half of the ability to drag and drop. Consequently, and since this action is only in a GUI environment, you will need to consider whether visitors to your IIIF interface would benefit from some kind of support text.
23
33
34
+
Viewer developers will have a special need to consider security when implementing a droppable interface.
35
+
24
36
## Example
25
37
26
-
Describe the solution in prose and provide an example.
27
-
The example json document must be an external document, and imported with the following:
38
+
Below are a link to this recipe's Manifest, an image of the IIIF logo decorated with the appropriate JavaScript event handler attributes, and a visible version of the script called by the image's event handlers. For a supporting viewer, the IIIF logo image below could be dragged onto its viewing area and dropped, which would result in the viewer retrieving the manifest for the IIIF Cookbook recipe titled ["Internationalization and Multi-language Values"][0006].
28
39
29
40
{% include manifest_links.html viewers="" manifest="manifest.json" %}
30
41
31
42
<imgsrc="https://iiif.io/api/cookbook/assets/images/logos/logo-sm.png"draggable="true"ondragstart="drag(event)"alt="IIIF logo; drag and drop onto a supporting viewer to see this resource in that viewer">
0 commit comments