12345678910111213141516171819202122232425262728293031323334353637 |
- import VectorType from '../enum/VectorType.js'
- import Geometry from './Geometry'
- import { coordinate } from '../Coordinate'
- import { mathUtil } from '../MathUtil.js'
- export default class Compass extends Geometry {
- constructor(angle,vectorId, floor) {
- super()
- this.angle = angle?angle:0
- this.floor = floor?floor:0
- //固定位置
- this.center = {
- x:800,
- y:170
- }
- this.radius = 52 //svg的大小
- this.geoType = VectorType.Compass
- this.setId(vectorId)
- }
- setAngle(angle){
- this.angle = angle
- }
- isContain(position) {
- const point = coordinate.getScreenXY(position)
- const dis = mathUtil.getDistance(this.center,point)
- if(dis < this.radius){
- return true
- }
- else{
- return false;
- }
- }
- }
|