摘要: 通过 containsPoint 方法坐标是否在某个元素内 const rect = new fabric.Rect({ width: 100, height: 100, fill: 'red', }) canvas.add(rect); canvas.on('mousee:down', (even 阅读全文
posted @ 2023-08-21 18:43 浅唱年华1920 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 链表实现队列 /** * 1.单项链表实现队列,但要同时记录head和tail * 2.要从tail入队,head出对, 否则出队时,tail不好定位 * 2.单独记录length,不可遍历链表获取length */ class MyQueue { head = null; // 头 tail = 阅读全文
posted @ 2023-07-01 12:10 浅唱年华1920 阅读(11) 评论(0) 推荐(0) 编辑
摘要: /** * 数组转链路表数据 - {value: A, next: {value: B, next: {value: C}} * @param {*} list arr * @returns */ function createLink(list) { let length = list.lengt 阅读全文
posted @ 2023-07-01 11:09 浅唱年华1920 阅读(25) 评论(0) 推荐(0) 编辑
摘要: vue中 数据驱动视图更新,是通过数据监听实现,也就是响应式 在vue2中通过 Object.defineProperty实现响应式,实现思路如下 监听对象,深度监听通过递归 数组监听通过重写数组原型方法 // 重新定义数组原型 const oldArrayPrototty = Array.prot 阅读全文
posted @ 2023-05-24 14:50 浅唱年华1920 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 深度比较 function isObject(obj) { return typeof obj 'object' && obj !== null } function isEqual(obj1, obj2) { if (!isObject(obj1) || !isObject(obj2)) { re 阅读全文
posted @ 2023-05-19 17:52 浅唱年华1920 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 通过es5 实现 类继承 通过super 给父级传参的效果 先看看 原型继承 function es5parent(name, age) { this.name = name; this.age = age; } es5parent.prototype.say = function() { cons 阅读全文
posted @ 2023-03-31 11:24 浅唱年华1920 阅读(106) 评论(0) 推荐(0) 编辑
摘要: call Function.prototype.mycall = function(context, ...args) { if (this Function.prototype) { return undefined; } context = context || window; const fn 阅读全文
posted @ 2023-03-30 16:19 浅唱年华1920 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 导入包 import {Vector as VectorLayer, Heatmap as HeatmapLayer} from 'ol/layer'; import { Vector as VectorSource } from 'ol/source'; import Feature from " 阅读全文
posted @ 2022-10-27 10:37 浅唱年华1920 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 先地图初始化然后再添加图层 import {Vector as VectorLayer} from 'ol/layer'; import { Vector as VectorSource } from 'ol/source'; import { GeoJSON } from 'ol/format'; 阅读全文
posted @ 2022-10-27 10:19 浅唱年华1920 阅读(259) 评论(0) 推荐(0) 编辑
摘要: // 导航栏点击事件 toolbar.setOnClickListener{ // 打开侧滑栏 drawerLayout.openDrawer(leftSlideView); // 关闭侧滑栏 // drawerLayout.closeDrawer(leftSlideView); } 阅读全文
posted @ 2021-07-08 18:27 浅唱年华1920 阅读(76) 评论(0) 推荐(0) 编辑