Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on iOS viroImage onClick don't use the viroscene top position but always the top of the screen. #300

Open
Turtleted21 opened this issue Jun 26, 2024 · 0 comments

Comments

@Turtleted21
Copy link

Turtleted21 commented Jun 26, 2024

Environment

1.Development OS: Mac
2. Device OS & Version: iOS 14, 15, 16 (work on Android)
3.Version: ViroReact version 2.23.1 and React Native version 0.71.3
4.Device(s): iPhone SE iOS 15.x, iPhone 8, iOS 16.5.1

Description

Hello

On iOS viroImage onClick don't use the viroscene top position but always the top of the screen.
So if I have a menu on the top of my viroscene, the menu height is not taken into account when calculating the onClick position.
Menu height is not applied to the onClick position, so onClick position have a Y offset with the viroImage.
If I remove my menu, click position is correct, click is over the viromage.

Thanks

Reproducible Demo

  const Menu = MENUS[sceneId]

  return (
    <View style={styles.container}>
      <ViroARSceneNavigator
        initialScene={{
          scene,
        }}
        style={styles.container}
      />

      <Menu />
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
})
return (
      <ViroARScene>
       
        <ViroNode
          scale={scale || 0} // onPinch
          onPinch={this._onPinch}
          ref={this._setARNodeRef}
        >

          <ViroAmbientLight color="#aaaaaa" />

          <ViroImage // -- Picto --
            source={N1}
            position={[0, 0.052, -0.025]}
            scale={[0.03, 0.03, 0.03]}
            rotationPivot={[0, 0.01, 0]}
            transformBehaviors={['billboard']}
            visible={displayAnnotation}
            onClick={this.handleDisplayLegend(1)}
          />

          <Viro3DObject // model -------------------------------
            source={MODEL}
            position={[0, 0, 0]}
            scale={[1.1, 1.1, 1.1]}
            type="GLB"
            onLoadStart={_onLoadStart}
            onLoadEnd={_onLoadEnd}
            onError={this._onError}
            ignoreEventHandling={true}
          />
          <ViroOrbitCamera position={[0, 0.05, 0.22]} focalPoint={[0, 0, -0.22]} active={true} />
        </ViroNode>
      </ViroARScene>

viro_onclick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant