当前位置: 首页 > wzjs >正文

网站单个页面做301整站seo技术搜索引擎优化

网站单个页面做301,整站seo技术搜索引擎优化,wordpress openbox主题,无忧网络网站建设这一节主要了解一下Compose中多点触控,在Jetpack Compose 中,多点触控处理需要结合Modifier和手势API来实现,一般通过组合 pointerInput、TransformableState 和 TransformModifier 来创建支持缩放、旋转和平移的组件。 一、 API 1. Pointer…

         这一节主要了解一下Compose中多点触控,在Jetpack Compose 中,多点触控处理需要结合Modifier和手势API来实现,一般通过组合 pointerInput、TransformableState 和 TransformModifier 来创建支持缩放、旋转和平移的组件。

一、 API
1. PointerInput
含义:处理低级触摸事件的主要API,支持多点触控。
用法:通过pointerInput修饰符拦截和处理触摸事件。
2. TransformableState
含义:管理变换状态(缩放、旋转、平移)的状态容器。
用法:与transformable修饰符结合,监听手势并更新变换值。
3. TransformModifier
含义:应用变换效果(缩放、旋转、平移)的修饰符。
用法:通过graphicsLayer或transformable应用变换。
二、关键类与接口
1. PointerInputScope
提供处理触摸事件的作用域,包含:
detectDragGestures:处理单指拖拽。
detectTransformGestures:处理双指缩放 / 旋转。
detectTapGestures:处理点击事件。
2. TransformScope
在detectTransformGestures中提供:
panChange:平移变化量。
zoomChange:缩放变化量。
rotationChange:旋转变化量。
3. Transformation
包含三个变换参数:
scale:缩放因子。
rotation:旋转角度。
offset:平移偏移量。

栗子:

1. 单指拖拽

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.consumeAllChanges
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.example.composenavigationdemo.R@Composable
fun TestImage() {var offset by remember { mutableStateOf(Offset.Zero) }Box(modifier = Modifier.size(200.dp).background(Color.LightGray).pointerInput(Unit) {detectDragGestures { change, dragAmount ->// 阻止事件冒泡change.consumeAllChanges()// 更新偏移量offset = offset + dragAmount}}.graphicsLayer {translationX = offset.xtranslationY = offset.y}) {Image(painter = painterResource(R.drawable.android),contentDescription = null,modifier = Modifier.fillMaxSize())}
}

2. 双指缩放与旋转

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectTransformGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.res.painterResource
import com.example.composenavigationdemo.R@Composable
fun TestImage() {var scale by remember { mutableStateOf(1f) }var rotation by remember { mutableStateOf(0f) }var offset by remember { mutableStateOf(Offset.Zero) }Box(modifier = Modifier.fillMaxSize().background(Color.LightGray).pointerInput(Unit) {detectTransformGestures { centroid, pan, zoom, rotationChange ->// 更新变换参数scale = (scale * zoom).coerceIn(0.5f, 5f)rotation += rotationChangeoffset = centroid}}) {Image(painter = painterResource(R.drawable.android),contentDescription = null,modifier = Modifier.align(Alignment.Center).graphicsLayer {scaleX = scalescaleY = scalerotationZ = rotationtranslationX = offset.x - size.width / 2translationY = offset.y - size.height / 2})}
}

3 组合多种手势

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.gestures.detectTransformGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.res.painterResource
import com.example.composenavigationdemo.R
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch@Composable
fun TestImage() {var scale by remember { mutableStateOf(1f) }var rotation by remember { mutableStateOf(0f) }var offset by remember { mutableStateOf(Offset.Zero) }var isDragging by remember { mutableStateOf(false) }Box(modifier = Modifier.fillMaxSize().background(Color.LightGray).pointerInput(Unit) {coroutineScope {launch {detectDragGestures(onDragStart = { isDragging = true },onDragEnd = { isDragging = false }) { change, dragAmount ->offset += dragAmount}}launch {detectTransformGestures(panZoomLock = true) { _, pan, zoom, rotationChange ->scale *= zoomrotation += rotationChangeoffset += pan}}}}.graphicsLayer {scaleX = scalescaleY = scalerotationZ = rotationtranslationX = offset.xtranslationY = offset.y}) {Image(painter = painterResource(R.drawable.android),contentDescription = null,modifier = Modifier.align(Alignment.Center))}
}

注意:
1 事件消费:通过change.consumeAllChanges()阻止事件冒泡。
2 坐标系转换:注意centroid(双指中心点)和offset的坐标系差异。
3 状态管理:使用remember保存变换状态,确保配置变更后状态恢复。

http://www.dtcms.com/wzjs/236888.html

相关文章:

  • 网站标签怎么做跳转免费开店的电商平台
  • 做 理财网站有哪些问题百度app推广方法
  • 外贸网站优化排名网站优化外包顾问
  • 生道网站建设平台百度域名
  • 如何在720云网站做全景视频下载营销网站建设选择
  • 手机做图片的网站软文网官网
  • 惠阳做网站营销培训课程有哪些
  • 网站 的版面结构产品推广方式有哪些
  • 葫芦岛建设厅网站十大接单推广平台
  • 杭州专业网站建设百度外包公司有哪些
  • 企业网站托管外包方案高质量关键词搜索排名
  • 做旅行网站的依据及意义怎么创建网站免费建立个人网站
  • 河源公司做网站百度下载安装官方下载
  • 网站开发人员主要干什么的网址大全导航
  • 国内看netflix的vpsqq群排名优化软件官网
  • 合作seo公司济南做seo外包
  • 浙江省嘉兴建设局官方网站电商代运营一般收多少服务费
  • 网站开发实用技术第二版答案hs网站推广
  • 做网站公司佛山东莞网络推广招聘
  • 深圳专门网站建设石家庄整站优化技术
  • 有了自己的域名怎么做网站seo推广培训资料
  • 邛崃网站建设廊坊首页霸屏优化
  • 如何登录中国建设银行网站新闻联播俄罗斯与乌克兰
  • 手机网站开发建设方案长沙网络优化产品
  • 江苏启安建设集团有限公司网站网络营销方案的范文
  • 平台式网站模板网络推广人员是干什么的
  • 建正建设官方网站资源最全的网盘搜索引擎
  • 许昌网站建设google开户
  • 凡客建站官网登录入口app引导页模板html
  • 网站建设合同注意点做销售记住这十句口诀