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

有高度的Maker信息框错位 #1121

Closed
whlysu opened this issue May 11, 2020 · 1 comment
Closed

有高度的Maker信息框错位 #1121

whlysu opened this issue May 11, 2020 · 1 comment
Labels

Comments

@whlysu
Copy link

whlysu commented May 11, 2020

maptalks's version and what browser you use?

0.47.0

Issue description

有高度的Maker弹出信息框,旋转地图,信息库和maker的相对位置不对。

Please provide a reproduction URL (on any jsfiddle like site)

https://codepen.io/whlysu/pen/XWmqvzM

@whlysu
Copy link
Author

whlysu commented May 13, 2020

这个bug我改了,改的比较狼狈,贴出代码供大家参考,期望作者在下个版本进行修复
get3DPosition(){
const size = this.getSize();
const o = new Point(-size['width'] / 2, 0);
if (!this.options['custom']) {
o._sub(4, 12);
} else {
o._sub(0, size['height']);
}
const owner = this.getOwner();
if (owner instanceof Marker || owner instanceof MultiPoint) {
let painter, markerSize;
if (owner instanceof Marker) {
painter = owner._getPainter();
markerSize = owner.getSize();

        } else {
            const children = owner.getGeometries();
            if (!children || !children.length) {
                return o;
            }
            painter = children[0]._getPainter();
            markerSize = children[0].getSize();
        }
        if (painter) {
            const fixExtent = painter.getFixedExtent();
            o._add(fixExtent.xmax - markerSize.width / 2, fixExtent.ymin);

            const points = owner._getRenderPoints()[0];
            if(painter.containerOffset === undefined){
                const renderer = painter.getLayer()._getRenderer();
                painter.containerOffset = painter.getMap()._pointToContainerPoint(renderer.southWest)._add(0, -painter.getMap().height);
            }
            const pps = painter._pointContainerPoints(points, 0, 0, undefined, true, undefined);
            const op = this.getMap().offsetPlatform()
            console.log("offset:" + o.x + "," + o.y);

            o._add(pps[0]);
            o._sub(op); //这里的偏移需要再加上 bnmap-front div的translate3d
        }
    }


    return o.round();
}

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

No branches or pull requests

2 participants