UNPKG

bindingx-web-polyfill

Version:

The web polyfill for BindingX.

67 lines (48 loc) 1.32 kB
/** Copyright 2018 Alibaba Group Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ 'use strict'; export default class Euler { static RotationOrders = ['XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX']; static DefaultOrder = 'XYZ'; isEuler = true; _x = 0; _y = 0; _z = 0; constructor(x, y, z, order) { this._x = x || 0; this._y = y || 0; this._z = z || 0; this._order = order || Euler.DefaultOrder; } get order() { return this._order; } set order(value) { this._order = value; this.onChangeCallback(); } set(x, y, z, order) { this._x = x; this._y = y; this._z = z; this._order = order || this._order; this.onChangeCallback(); return this; } onChange(callback) { this.onChangeCallback = callback; return this; } onChangeCallback() { } }