Commit 7769b402 authored by 范雪寒's avatar 范雪寒

feat:

parent 5273b826
......@@ -256,12 +256,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
const rect = pageData.hotZoneItemArr[this.currentPartIdx].rect;
const x = ((rect.x + rect.width / 2) - bgRect.width / 2) * partImg.width / bgRect.width;
const y = (bgRect.height / 2 - (rect.y + rect.height / 2)) * partImg.height / bgRect.height;
partImg.x = x;
partImg.y = y;
partImg.scale = Math.min(
(partImg.parent.width / partImg.width) * (bgRect.width / rect.width),
(partImg.parent.height / partImg.height) * (bgRect.height / rect.height)
);
partImg.x = x * partImg.scale;
partImg.y = y * partImg.scale;
console.log('partImg.scale = ' + partImg.scale);
console.log('partImg.x = ' + partImg.x);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment