                 @_frame_labels.push(@add_text(pos:[x,y,z], text:text, fontsize:o.fontsize, color:o.color, constant_size:false))
 
             offset = 0.075
-            mx = (o.xmin+o.xmax)/2
-            my = (o.ymin+o.ymax)/2
-            mz = (o.zmin+o.zmax)/2
-            @_center = new THREE.Vector3(mx,my,mz)
-
             if o.draw
                 e = (o.ymax - o.ymin)*offset
                 txt(o.xmax,o.ymin-e,o.zmin, l(o.zmin))

            draw      : true

        @_frame_params = o
        #console.log("official set_frame=#{misc.to_json(o)}")

        eps = 0.1
        if Math.abs(o.xmax-o.xmin)<eps
            o.xmax += 1

            o.zmax += 1
            o.zmin -= 1

        mx = (o.xmin+o.xmax)/2
        my = (o.ymin+o.ymax)/2
        mz = (o.zmin+o.zmax)/2
        @_center = new THREE.Vector3(mx,my,mz)

        if o.draw
            if @frame?
                # remove existing frame
                for x in @frame
                    @scene.remove(x)
                delete @frame
            @frame = []
            x0 = o.xmin; x1 = o.xmax; y0 = o.ymin; y1 = o.ymax; z0 = o.zmin; z1 = o.zmax
            v = [[[x0,y0,z0], [x1,y0,z0], [x1,y1,z0], [x0,y1,z0], [x0,y0,z0],
                  [x0,y0,z1], [x1,y0,z1], [x1,y1,z1], [x0,y1,z1], [x0,y0,z1]],
                 [[x1,y0,z0], [x1,y0,z1]],
                 [[x0,y1,z0], [x0,y1,z1]],
                 [[x1,y1,z0], [x1,y1,z1]]]
            for points in v
                line = @add_line
                    points    : points
                    color     : o.color
                    thickness : o.thickness
                @frame.push(line)

        if o.draw and o.labels

