Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: elements/designer-selection/ResizeDirection.js

Issue 877243005: Add designer-selection element (Closed) Base URL: https://github.com/PolymerLabs/designer2.git@master
Patch Set: Address more review comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « elements/designer-selection/README.md ('k') | elements/designer-selection/demo.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /**
2 * @license
3 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polyme r.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS. txt
6 * The complete set of contributors may be found at http://polymer.github.io/CON TRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PA TENTS.txt
9 */
10
11 function ResizeDirection(name, x, y) {
12 this.name = name;
13 this.x = x;
14 this.y = y;
15 }
16
17 ResizeDirection.prototype.toString = function() {
18 return 'ResizeDirection(' + this.name + ', ' + this.x + ', ' +
19 this.y + ')';
20 };
21
22 ResizeDirection.prototype.locate = function(rect) {
23 return {
24 x: rect.left + rect.width * this.x,
25 y: rect.top + rect.height * this.y
26 };
27 };
28
29 ResizeDirection.prototype.resizesLeft = function() {
30 return this.x == 0.0;
31 },
32
33 ResizeDirection.prototype.resizesRight = function() {
34 return this.x == 1.0;
35 },
36
37 ResizeDirection.prototype.resizesTop = function() {
38 return this.y == 0.0;
39 },
40
41 ResizeDirection.prototype.resizesBottom = function() {
42 return this.y == 1.0;
43 },
44
45 (function () {
46 var top = ResizeDirection.top = new ResizeDirection('top', 0.5, 0.0);
47 var left = ResizeDirection.left = new ResizeDirection('left', 0.0, 0.5);
48 var bottom = ResizeDirection.bottom = new ResizeDirection('bottom', 0.5, 1.0);
49 var right = ResizeDirection.right = new ResizeDirection('right', 1.0, 0.5);
50 var top_left = ResizeDirection.top_left = new ResizeDirection('top_left', 0.0, 0.0);
51 var top_right = ResizeDirection.top_right = new ResizeDirection('top_right', 1 .0, 0.0);
52 var bottom_left = ResizeDirection.bottom_left = new ResizeDirection('bottom_le ft', 0.0, 1.0);
53 var bottom_right = ResizeDirection.bottom_right = new ResizeDirection('bottom_ right', 1.0, 1.0);
54
55 ResizeDirection.all_directions = [top, left, bottom, right, top_left, top_righ t, bottom_left, bottom_right];
56 ResizeDirection.width_height = [bottom, right, bottom_right];
57 })();
OLDNEW
« no previous file with comments | « elements/designer-selection/README.md ('k') | elements/designer-selection/demo.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698