版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

96 строки
2.9 KiB

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /**
  20. * AUTO-GENERATED FILE. DO NOT MODIFY.
  21. */
  22. /*
  23. * Licensed to the Apache Software Foundation (ASF) under one
  24. * or more contributor license agreements. See the NOTICE file
  25. * distributed with this work for additional information
  26. * regarding copyright ownership. The ASF licenses this file
  27. * to you under the Apache License, Version 2.0 (the
  28. * "License"); you may not use this file except in compliance
  29. * with the License. You may obtain a copy of the License at
  30. *
  31. * http://www.apache.org/licenses/LICENSE-2.0
  32. *
  33. * Unless required by applicable law or agreed to in writing,
  34. * software distributed under the License is distributed on an
  35. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  36. * KIND, either express or implied. See the License for the
  37. * specific language governing permissions and limitations
  38. * under the License.
  39. */
  40. import { __extends } from "tslib";
  41. import Path from 'zrender/lib/graphic/Path.js';
  42. var PointerShape =
  43. /** @class */
  44. function () {
  45. function PointerShape() {
  46. this.angle = 0;
  47. this.width = 10;
  48. this.r = 10;
  49. this.x = 0;
  50. this.y = 0;
  51. }
  52. return PointerShape;
  53. }();
  54. var PointerPath =
  55. /** @class */
  56. function (_super) {
  57. __extends(PointerPath, _super);
  58. function PointerPath(opts) {
  59. var _this = _super.call(this, opts) || this;
  60. _this.type = 'pointer';
  61. return _this;
  62. }
  63. PointerPath.prototype.getDefaultShape = function () {
  64. return new PointerShape();
  65. };
  66. PointerPath.prototype.buildPath = function (ctx, shape) {
  67. var mathCos = Math.cos;
  68. var mathSin = Math.sin;
  69. var r = shape.r;
  70. var width = shape.width;
  71. var angle = shape.angle;
  72. var x = shape.x - mathCos(angle) * width * (width >= r / 3 ? 1 : 2);
  73. var y = shape.y - mathSin(angle) * width * (width >= r / 3 ? 1 : 2);
  74. angle = shape.angle - Math.PI / 2;
  75. ctx.moveTo(x, y);
  76. ctx.lineTo(shape.x + mathCos(angle) * width, shape.y + mathSin(angle) * width);
  77. ctx.lineTo(shape.x + mathCos(shape.angle) * r, shape.y + mathSin(shape.angle) * r);
  78. ctx.lineTo(shape.x - mathCos(angle) * width, shape.y - mathSin(angle) * width);
  79. ctx.lineTo(x, y);
  80. };
  81. return PointerPath;
  82. }(Path);
  83. export default PointerPath;