<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "https://www.web3d.org/specifications/x3d-3.2.dtd">
<X3D profile='Immersive' version='3.2' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.2.xsd'>
  <head>
    <meta content='DoubleClickTouchSensorExample.x3d' name='title'/>
    <meta content='Double-click TouchSensor design pattern, showing example use.' name='description'/>
    <meta content='Don Brutzman' name='creator'/>
    <meta content='26 May 2003' name='created'/>
    <meta content='17 June 2020' name='modified'/>
    <meta content='DoubleClickTouchSensorPrototype.x3d' name='reference'/>
    <meta content='https://www.web3d.org/x3d/specifications/ISO-IEC-19775-FDIS-X3dAbstractSpecification/Part01/components/pointingsensor.html#TouchSensor' name='reference'/>
    <meta content='DoubleClickTouchSensor' name='subject'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/DoubleClickTouchSensorExample.x3d' name='identifier'/>
    <meta content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='DoubleClickTouchSensorExample.x3d'/>
    <ExternProtoDeclare appinfo='TimeSensor functionality commences after delayInterval pause' name='TimeDelaySensor' url='"TimeDelaySensorPrototype.x3d#TimeDelaySensor" "../../../Savage/Tools/Animation/TimeDelaySensorPrototype.x3d#TimeDelaySensor" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/TimeDelaySensorPrototype.x3d#TimeDelaySensor" "TimeDelaySensorPrototype.wrl#TimeDelaySensor" "../../../Savage/Tools/Animation/TimeDelaySensorPrototype.wrl#TimeDelaySensor" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/TimeDelaySensorPrototype.wrl#TimeDelaySensor"'>
      <field accessType='inputOutput' appinfo='describe the purpose of this sensor' name='description' type='SFString'/>
      <field accessType='inputOutput' name='startTime' type='SFTime'/>
      <field accessType='inputOutput' name='enabled' type='SFBool'/>
      <field accessType='inputOutput' appinfo='seconds' name='delayInterval' type='SFTime'/>
      <field accessType='outputOnly' name='delayCompleteTime' type='SFTime'/>
      <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
    </ExternProtoDeclare>
    <ExternProtoDeclare appinfo='DoubleClickTouchSensor functionality activates when user double clicks (or double selects) within maxDelayInterval' name='DoubleClickTouchSensor' url='"DoubleClickTouchSensorPrototype.x3d#DoubleClickTouchSensor" "../../../Savage/Tools/Animation/DoubleClickTouchSensorPrototype.x3d#DoubleClickTouchSensor" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/DoubleClickTouchSensorPrototype.x3d#DoubleClickTouchSensor" "DoubleClickTouchSensorPrototype.wrl#DoubleClickTouchSensor" "../../../Savage/Tools/Animation/DoubleClickTouchSensorPrototype.wrl#DoubleClickTouchSensor" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/DoubleClickTouchSensorPrototype.wrl#DoubleClickTouchSensor"'>
      <field accessType='inputOutput' appinfo='describe the purpose of this sensor' name='description' type='SFString'/>
      <field accessType='initializeOnly' appinfo='seconds' name='maxDelayInterval' type='SFTime'/>
      <field accessType='inputOutput' name='enabled' type='SFBool'/>
      <field accessType='outputOnly' name='isActive' type='SFBool'/>
      <field accessType='outputOnly' name='isOver' type='SFBool'/>
      <field accessType='outputOnly' appinfo='seconds' name='touchTime' type='SFTime'/>
      <field accessType='outputOnly' name='hitPoint_changed' type='SFVec3f'/>
      <field accessType='outputOnly' name='hitNormal_changed' type='SFVec3f'/>
      <field accessType='outputOnly' name='hitTexCoord_changed' type='SFVec2f'/>
      <field accessType='initializeOnly' appinfo='can contain one of Metadata nodes' name='metadata' type='SFNode'>
        <!-- initialization node (if any) goes here -->
      </field>
      <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
    </ExternProtoDeclare>
    <!-- ==================== -->
    <Group DEF='TextTouchGroup'>
      <Shape>
        <Text string='"Double-click text then" "wait for 1-second time delay" "before color changes"'>
          <FontStyle justify='"MIDDLE" "MIDDLE"'/>
        </Text>
        <Appearance>
          <Material DEF='TextColor'/>
        </Appearance>
      </Shape>
      <ProtoInstance DEF='TouchSensorActive' name='DoubleClickTouchSensor'>
        <fieldValue name='description' value='double click to initiate time delay and color change'/>
        <fieldValue name='traceEnabled' value='true'/>
        <fieldValue name='metadata'>
          <MetadataString name='exampleTerm' value='"exampleValue"'/>
        </fieldValue>
      </ProtoInstance>
      <!-- ==================== -->
      <Group DEF='TextAnimationGroup'>
        <ProtoInstance DEF='DelayTimer' name='TimeDelaySensor'>
          <fieldValue name='delayInterval' value='1'/>
          <fieldValue name='traceEnabled' value='true'/>
        </ProtoInstance>
        <TimeSensor DEF='AnimationClock' cycleInterval='2'/>
        <ROUTE fromField='touchTime' fromNode='TouchSensorActive' toField='startTime' toNode='DelayTimer'/>
        <ROUTE fromField='delayCompleteTime' fromNode='DelayTimer' toField='set_startTime' toNode='AnimationClock'/>
        <ColorInterpolator DEF='ColorChangerRGB' key='0 0.5 1' keyValue='1 0 0 0 1 0 0 0 1'/>
        <ROUTE fromField='value_changed' fromNode='ColorChangerRGB' toField='diffuseColor' toNode='TextColor'/>
        <ROUTE fromField='fraction_changed' fromNode='AnimationClock' toField='set_fraction' toNode='ColorChangerRGB'/>
      </Group>
    </Group>
  </Scene>
</X3D>