You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

[Wear OS][WFF] BoundingArc点击测试范围异常问题及修复咨询

WFF BoundingArc 点击问题修复方案

问题分析

  1. 点击区域误判:当ComplicationSlot的x/y/width/height设置为全屏或过大范围时,系统会优先用这个矩形区域做点击检测,完全忽略BoundingArc定义的精确弧形范围,导致点击椭圆任意区域都会触发响应。
  2. 重叠区域点击失效:多个ComplicationSlot的矩形区域大面积重叠时,系统按渲染顺序处理点击事件,只有最后一个渲染的Slot能响应,前面的Slot会被覆盖。

修复步骤

  • 为每个ComplicationSlot设置刚好包裹自身BoundingArc的最小矩形,替换原来的全屏/大尺寸矩形,让系统优先使用BoundingArc做精确点击检测。
  • 确保不同Slot的矩形区域仅覆盖自身弧形范围,避免不必要的重叠。

修复后的代码

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<WatchFace height="450" width="450">
  <Scene>
    <!-- Slot0:调整x/y/width/height为包裹弧形的最小矩形 -->
    <ComplicationSlot
        x="40" y="25"
        width="190" height="180"
        slotId="0"
        name="slot0" displayName="slot0"
        supportedTypes="SHORT_TEXT EMPTY">
      <DefaultProviderPolicy
          primaryProvider="com.google.android.gm/com.google.android.apps.gmail.wear.complications.UnreadEmailsComplicationService"
          primaryProviderType="SHORT_TEXT"
          defaultSystemProvider="SUNRISE_SUNSET"
          defaultSystemProviderType="SHORT_TEXT"
          />
      <BoundingArc centerX="225" centerY="225" width="435"
          height="435" thickness="40" isRoundEdge="true"
          startAngle="100" endAngle="170"
          direction="CLOCKWISE" />

      <Complication type="SHORT_TEXT">
        <Group name="Complications" width="450" height="450" x="0" y="0" alpha="255">
          <Variant mode="AMBIENT" target="alpha" value="0" />
          <PartDraw x="0" y="0" height="450" width="450">
            <Arc direction="CLOCKWISE" startAngle="100" endAngle="170" centerX="225" centerY="225" width="410" height="410">
              <Stroke color="#4444FF" cap="ROUND" thickness="40">
              </Stroke>
            </Arc>
          </PartDraw>
        </Group>
      </Complication>
    </ComplicationSlot>

    <!-- Slot1:调整x/y/width/height为包裹弧形的最小矩形 -->
    <ComplicationSlot
        x="230" y="25"
        width="190" height="180"
        slotId="1"
        name="slot1" displayName="slot1"
        supportedTypes="SHORT_TEXT EMPTY">
      <DefaultProviderPolicy
          primaryProvider="com.google.android.gm/com.google.android.apps.gmail.wear.complications.UnreadEmailsComplicationService"
          primaryProviderType="SHORT_TEXT"
          defaultSystemProvider="SUNRISE_SUNSET"
          defaultSystemProviderType="SHORT_TEXT"
          />
      <BoundingArc centerX="225" centerY="225" width="435"
          height="435" thickness="40" isRoundEdge="true"
          startAngle="190" endAngle="260"
          direction="CLOCKWISE" />

      <Complication type="SHORT_TEXT">
        <Group name="Complications" width="450" height="450" x="0" y="0" alpha="255">
          <Variant mode="AMBIENT" target="alpha" value="0" />
          <PartDraw x="0" y="0" height="450" width="450">
            <Arc direction="CLOCKWISE" startAngle="190" endAngle="260" centerX="225" centerY="225" width="410" height="410">
              <Stroke color="#44FF44" cap="ROUND" thickness="40">
              </Stroke>
            </Arc>
          </PartDraw>
        </Group>
      </Complication>
    </ComplicationSlot>
  </Scene>
</WatchFace>

补充说明

  • 代码中调整后的x/y/width/height是根据BoundingArc的弧形范围计算出的最小包裹矩形,你可以根据实际视觉效果微调数值,确保刚好覆盖弧形区域即可。
  • 当ComplicationSlot的矩形区域不超出自身弧形范围时,系统会自动使用BoundingArc的精确弧形进行点击检测,同时解决了重叠区域的点击覆盖问题。

内容的提问来源于stack exchange,提问作者herman man

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 19:10:15