react / wstein / node_modules / jest-cli / node_modules / jsdom / node_modules / cssstyle / lib / properties / azimuth.js
81145 views'use strict';12var parsers = require('../parsers');34module.exports.definition = {5set: function (v) {6var valueType = parsers.valueType(v);7if (valueType === parsers.TYPES.ANGLE) {8return this._setProperty('azimuth', parsers.parseAngle(v));9}10if (valueType === parsers.TYPES.KEYWORD) {11var keywords = v.toLowerCase().trim().split(/\s+/);12var hasBehind = false;13if (keywords.length > 2) {14return;15}16var behindIndex = keywords.indexOf('behind');17hasBehind = (behindIndex !== -1);1819if (keywords.length === 2) {20if (!hasBehind) {21return;22}23keywords.splice(behindIndex, 1);24}25if (keywords[0] === 'leftwards' || keywords[0] === 'rightwards') {26if (hasBehind) {27return;28}29return this._setProperty('azimuth', keywords[0]);30}31if (keywords[0] === 'behind') {32return this._setProperty('azimuth', '180deg');33}34var deg;35switch (keywords[0]) {36case 'left-side':37return this._setProperty('azimuth', '270deg');38case 'far-left':39return this._setProperty('azimuth', (hasBehind ? 240 : 300) + 'deg');40case 'left':41return this._setProperty('azimuth', (hasBehind ? 220 : 320) + 'deg');42case 'center-left':43return this._setProperty('azimuth', (hasBehind ? 200 : 340) + 'deg');44case 'center':45return this._setProperty('azimuth', (hasBehind ? 180 : 0) + 'deg');46case 'center-right':47return this._setProperty('azimuth', (hasBehind ? 160 : 20) + 'deg');48case 'right':49return this._setProperty('azimuth', (hasBehind ? 140 : 40) + 'deg');50case 'far-right':51return this._setProperty('azimuth', (hasBehind ? 120 : 60) + 'deg');52case 'right-side':53return this._setProperty('azimuth', '90deg');54default:55return;56}57}58},59get: function () {60return this.getPropertyValue('azimuth');61},62enumerable: true,63configurable: true64};656667