Amélioration des hotspots
authorPatrick PIERRE
mar., 09 avril 2013 18:34:13 +0200
changeset 191 e50ac13ec921
parent 190 546609a92447
child 192 c56f8c6b2868
Amélioration des hotspots
RelaxNG/Examples/Documents/torture_test.xml
RelaxNG/publidoc.rnc
--- a/RelaxNG/Examples/Documents/torture_test.xml	lun. avril 08 13:27:02 2013 +0200
+++ b/RelaxNG/Examples/Documents/torture_test.xml	mar. avril 09 18:34:13 2013 +0200
@@ -568,32 +568,31 @@
             </p>
             <media>
               <image id="f-gcru">
-                <hotspot x="23.5%" y="48.7%" w="7.5%" h="14.2%" type="normal"
-                         dx="-1%" dy="-4.1%" dw="0%">
-                  <p>Directionnel</p>
+                <hotspot x="23.5%" y="48.7%" w="7.5%" h="14.2%" type="normal">
+                  <spot  dx="-1%" dy="-4.1%"><p>Directionnel</p></spot>
                   <scenario>
-                    <init action="hide"/>
-                    <onclick action="show"/>
+                    <init  action="hide" target="spot"/>
+                    <onclick action="show" target="spot"/>
                   </scenario>
                 </hotspot>
-                <hotspot x="68.2%" y="33.2%" w="7.5%" h="14.2%" type="visible"
-                         dx="-2.5%" dy="-4.1%" dw="0%">
-                  <p>Compte-tours</p>
+                <hotspot x="68.2%" y="33.2%" w="7.5%" h="14.2%" type="visible">
+                  <spot dx="-2.5%" dy="-4.1%"><p>Compte-tours</p></spot>
                   <scenario>
-                    <init action="hide"/>
-                    <onclick action="show"/>
+                    <init action="hide" target="spot"/>
+                    <onclick action="show" target="spot"/>
                   </scenario>
                  </hotspot>
-                <hotspot x="55.3%" y="67.8%" w="7.5%" type="pulse"
-                         dx="-2.5%" dy="-6%" dw="5%">
-                  <image id="zoom_oil"/>
+                <hotspot x="55.3%" y="67.8%" w="7.5%" type="pulse">
+                  <spot dx="-2.5%" dy="-6%" dw="5%">
+                    <image id="zoom_oil"/>
+                  </spot>
                   <scenario>
-                    <init action="hide"/>
-                    <onclick action="show"/>
+                    <init action="hide" target="spot"/>
+                    <onclick action="show" target="spot"/>
                   </scenario>
                  </hotspot>
                 <hotspot x="1%" y="93.5%" w="0%">
-                  <p>Copyright P²</p>
+                  <p>Planche de bord</p>
                 </hotspot>
               </image>
               <caption x="1%" y="1%">Robin DR-400, F-GCRU.</caption>
--- a/RelaxNG/publidoc.rnc	lun. avril 08 13:27:02 2013 +0200
+++ b/RelaxNG/publidoc.rnc	mar. avril 09 18:34:13 2013 +0200
@@ -120,10 +120,10 @@
 topic = element topic { topic.attributes, topic.content }
 
 topic.attributes =
-   (topic.id.attribute | topic.xmlid.attribute)?
+   (topic.id.attribute | xmlid.attribute)?
  & topic.type.attribute?
  & lang.attribute?
-topic.xmlid.attribute = attribute xml:id { xsd:ID }
+xmlid.attribute = attribute xml:id { xsd:ID }
 
 topic.content =
    component.head?,
@@ -347,6 +347,7 @@
 
 # ~~~~~~ image
 image = element image { image.attributes, image.content }
+hotspot.image = element image {image.attributes }
 
 image.attributes =
    media.id.attribute
@@ -380,25 +381,36 @@
  & y.attribute
  & w.attribute
  & h.attribute?
- & (hotspot.type.attribute
-  & dx.attribute?
-  & dy.attribute?
-  & dw.attribute?
-  & dh.attribute?)?
+ & hotspot.type.attribute?
+ & xmlid.attribute?
 x.attribute = attribute x { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
 y.attribute = attribute y { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
 w.attribute = attribute w { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
 h.attribute = attribute h { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
 hotspot.type.attribute = attribute type { "normal" | "visible" | "pulse" }
+   
+hotspot.content =
+   ((link | p+ | hotspot.image | audio | video), (spot, scenario?)?)
+ | (spot, scenario?)
+   
+# ~~~~~~ spot
+spot = element spot { spot.attributes, spot.content }
+
+spot.attributes =
+   dx.attribute?
+ & dy.attribute?
+ & dw.attribute?
+ & dh.attribute?
 dx.attribute = attribute dx { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
 dy.attribute = attribute dy { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
-dw.attribute = attribute dw { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
-dh.attribute = attribute dh { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
-   
-hotspot.content =
-   (p | link | image | audio | video),
-   scenario?
-   
+dw.attribute = attribute dw { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
+dh.attribute = attribute dh { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
+
+spot.content =
+   ((p+ | image), audio?)
+ | audio
+ | video
+
 # ~~~~~~ media.caption
 media.caption = element caption { caption.attributes, caption.content }
 
@@ -406,6 +418,32 @@
    x.attribute?
  & y.attribute?
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ scenario ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ scenario
+scenario = element scenario { scenario.content }
+
+scenario.content =
+   init*,
+   onclick*
+
+# ~~~~~~ init
+init = element init { init.attributes }
+
+init.attributes =
+   init.action.attribute
+ & target.attribute?
+init.action.attribute = attribute action { "hide" }
+target.attribute = attribute target { "hotspot" | "spot" }
+
+# ~~~~~~ onclick
+onclick = element onclick { onclick.attributes }
+
+onclick.attributes =
+   onclick.action.attribute
+ & target.attribute?
+onclick.action.attribute = attribute action { "show" }
+
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bibliograpgy.entry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 # ~~~~~~ bibliography.entry
@@ -433,29 +471,6 @@
 
 pages.content = xsd:positiveInteger
 
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ scenario ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-# ~~~~~~ scenario
-scenario = element scenario { scenario.content }
-
-scenario.content =
-   init*,
-   onclick*
-
-# ~~~~~~ init
-init = element init { init.attributes }
-
-init.attributes =
-   init.action.attribute
-init.action.attribute = attribute action { "hide" }
-
-# ~~~~~~ onclick
-onclick = element onclick { onclick.attributes }
-
-onclick.attributes =
-   onclick.action.attribute
-onclick.action.attribute = attribute action { "show" }
-
 
 # =============================================================================
 #                                 HEAD LEVEL