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-22Lines changed: 43 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ 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.
16
+
Alternately, as a viewer developer, you would like to allow your viewer to receive dragged-over items.
17
17
18
18
## Implementation Notes
19
19
@@ -23,31 +23,14 @@ Implementing this recipe requires a resource provider and a viewer each to imple
23
23
24
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
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.
29
-
30
-
## Restrictions
31
-
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.
33
-
34
-
Viewer developers will have a special need to consider security when implementing a droppable interface.
35
-
36
-
## Example
37
-
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].
39
-
40
-
{% include manifest_links.html viewers="" manifest="manifest.json" %}
41
-
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">
43
-
26
+
A script implementing such a method for a Manifest could look like the below.
Note that the script forces the manifest content into a string, which the receiving viewer's handling script is A script implementing such a method for a single Canvas of a Manifest could look like the below. (Noting that there is no likely practical difference from the above since this manifest contains but one Canvas.)
A supporting viewer must have an interface capable of handling the DataTransfer object's data carried by the draggable item in its `drop` event.
69
+
70
+
## Restrictions
71
+
72
+
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.
73
+
74
+
Viewer developers will have a special need to consider security when implementing a droppable interface.
75
+
76
+
## Example
77
+
78
+
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].
79
+
80
+
<imgsrc="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