operate-map-player.js 833 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
import {
  findElmById,
  invokeVmMethod,
  invokeVmMethodWithoutArgs
} from '../util'

const METHODS = {
  getCenterLocation (ctx, cbs) {
    return invokeVmMethodWithoutArgs(ctx, 'getCenterLocation', cbs)
  },
  moveToLocation (ctx) {
    return invokeVmMethodWithoutArgs(ctx, 'moveToLocation')
  },
  translateMarker (ctx, args) {
    return invokeVmMethod(ctx, 'translateMarker', args, ['animationEnd'])
  },
  includePoints (ctx, args) {
    return invokeVmMethod(ctx, 'includePoints', args)
  },
  getRegion (ctx, cbs) {
    return invokeVmMethodWithoutArgs(ctx, 'getRegion', cbs)
  },
  getScale (ctx, cbs) {
    return invokeVmMethodWithoutArgs(ctx, 'getScale', cbs)
  }
}

export function operateMapPlayer (mapId, pageVm, type, data) {
  return METHODS[type](findElmById(mapId, pageVm), data)
}