Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | 1x 1x 1x 1x 1x 1x 648360x 648360x 216189x 648360x 2786x 432171x 429385x 429385x 1x 1x 1x 429385x 429385x 429385x 648360x 648360x 648360x 648360x 648360x 648360x 1x 7872x 7872x 7872x 7872x 7872x 1x 611741x 611741x 1x 1x 606645x 606645x 1x 2x 2x 2x 1x 38037x 38037x 38037x 1x 318010x 318010x 1x 2x 2x 1x 318012x 318012x 106083x 211929x 105862x 106067x 106067x 318012x 1x 1x | /* * Paper.js - The Swiss Army Knife of Vector Graphics Scripting. * http://paperjs.org/ * * Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey * http://juerglehni.com/ & https://puckey.studio/ * * Distributed under the MIT license. See LICENSE file for details. * * All rights reserved. */ // TODO: remove eslint-disable comment and deal with errors over time /* eslint-disable */ import { ref } from '~/globals'; import { Point } from '~/basic/Point'; import { Numerical } from '~/util/Numerical'; import { SegmentSelection } from './SegmentSelection'; /** * @name SegmentPoint * @class An internal version of Point that notifies its segment of each change * * @private */ export const SegmentPoint = Point.extend({ initialize: function SegmentPoint(point, owner, key) { var x, y, selected; if (!point) { x = y = 0; } else if ((x = point[0]) !== undefined) { // Array-like y = point[1]; } else { // So we don't have to modify the point argument which would cause // deoptimization: var pt = point; // If not Point-like already, read Point from arguments if ((x = pt.x) === undefined) { pt = Point.read(arguments); x = pt.x; } y = pt.y; selected = pt.selected; } this._x = x; this._y = y; this._owner = owner; owner[key] = this; // We need to call #setSelected(true) after setting property on the // owner that references this point. if (selected) this.setSelected(true); }, // See Point#_set() for an explanation of #_set(): _set: function (x, y) { this._x = x; this._y = y; this._owner._changed(this); return this; }, getX: function () { return this._x; }, setX: function (x) { this._x = x; this._owner._changed(this); }, getY: function () { return this._y; }, setY: function (y) { this._y = y; this._owner._changed(this); }, isZero: function () { var isZero = Numerical.isZero; // Provide our own version of Point#isZero() that does not use the x / y // accessors but the internal properties directly, for performance // reasons, since it is used a lot internally. return isZero(this._x) && isZero(this._y); }, isSelected: function () { return !!(this._owner._selection & this._getSelection()); }, setSelected: function (selected) { this._owner._changeSelection(this._getSelection(), selected); }, _getSelection: function () { var owner = this._owner; return this === owner._point ? /*#=*/ SegmentSelection.POINT : this === owner._handleIn ? /*#=*/ SegmentSelection.HANDLE_IN : this === owner._handleOut ? /*#=*/ SegmentSelection.HANDLE_OUT : 0; }, }); ref.SegmentPoint = SegmentPoint; |